Compare commits
1 Commits
dev
...
9169630b43
| Author | SHA1 | Date | |
|---|---|---|---|
| 9169630b43 |
@@ -36,28 +36,79 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = inputs:
|
outputs =
|
||||||
|
inputs:
|
||||||
let
|
let
|
||||||
lib = inputs.nixpkgs.lib;
|
lib = inputs.nixpkgs.lib;
|
||||||
gen = import ./generator.nix { inherit inputs; };
|
supportedSystems = [
|
||||||
|
"x86_64-linux"
|
||||||
|
"aarch64-linux"
|
||||||
|
"x86_64-darwin"
|
||||||
|
"aarch64-darwin"
|
||||||
|
];
|
||||||
|
linuxSystems = [
|
||||||
|
"x86_64-linux"
|
||||||
|
"aarch64-linux"
|
||||||
|
];
|
||||||
|
forEachSystem = lib.genAttrs;
|
||||||
|
overlays = import ./overlays { inherit inputs; };
|
||||||
|
mkPkgs =
|
||||||
|
system:
|
||||||
|
import inputs.nixpkgs {
|
||||||
|
inherit system;
|
||||||
|
overlays = overlays ++ [
|
||||||
|
(final: prev: {
|
||||||
|
custom = import ./packages { pkgs = final; };
|
||||||
|
})
|
||||||
|
];
|
||||||
|
config.allowUnfree = true;
|
||||||
|
};
|
||||||
|
gen = import ./generator.nix { inherit inputs mkPkgs supportedSystems; };
|
||||||
systemsDir = ./systems;
|
systemsDir = ./systems;
|
||||||
isIgnoredSystemDir = name: lib.hasPrefix "_" name || lib.hasPrefix "." name;
|
isIgnoredSystemDir = name: lib.hasPrefix "_" name || lib.hasPrefix "." name;
|
||||||
systemNames = lib.attrNames (lib.filterAttrs
|
systemNames = lib.attrNames (
|
||||||
(name: type:
|
lib.filterAttrs (
|
||||||
|
name: type:
|
||||||
type == "directory"
|
type == "directory"
|
||||||
&& !isIgnoredSystemDir name
|
&& !isIgnoredSystemDir name
|
||||||
&& builtins.pathExists (systemsDir + "/${name}/cfg.nix"))
|
&& builtins.pathExists (systemsDir + "/${name}/cfg.nix")
|
||||||
(builtins.readDir systemsDir));
|
) (builtins.readDir systemsDir)
|
||||||
hostsByType = systemType:
|
);
|
||||||
lib.filter
|
hostsByType =
|
||||||
(host: (import (systemsDir + "/${host}/cfg.nix")).syscfg.type == systemType)
|
systemType:
|
||||||
systemNames;
|
lib.filter (host: (import (systemsDir + "/${host}/cfg.nix")).syscfg.type == systemType) systemNames;
|
||||||
generateHosts = systemType:
|
generateHosts =
|
||||||
lib.genAttrs
|
systemType: lib.genAttrs (hostsByType systemType) (host: gen.generate { inherit host; });
|
||||||
(hostsByType systemType)
|
flattenPackages =
|
||||||
(host: gen.generate { inherit host; });
|
prefix: attrs:
|
||||||
in {
|
lib.concatMapAttrs (
|
||||||
devShells = import ./shells { inherit inputs; };
|
name: value:
|
||||||
|
let
|
||||||
|
packageName = lib.concatStringsSep "-" (prefix ++ [ name ]);
|
||||||
|
defaultPackageName = lib.concatStringsSep "-" prefix;
|
||||||
|
in
|
||||||
|
if lib.isDerivation value then
|
||||||
|
{
|
||||||
|
"${if name == "default" && prefix != [ ] then defaultPackageName else packageName}" = value;
|
||||||
|
}
|
||||||
|
else if lib.isAttrs value then
|
||||||
|
flattenPackages (if name == "default" then prefix else prefix ++ [ name ]) value
|
||||||
|
else
|
||||||
|
{ }
|
||||||
|
) attrs;
|
||||||
|
mkPackages =
|
||||||
|
system:
|
||||||
|
let
|
||||||
|
pkgs = mkPkgs system;
|
||||||
|
in
|
||||||
|
lib.optionalAttrs pkgs.stdenv.isLinux (flattenPackages [ ] pkgs.custom);
|
||||||
|
in
|
||||||
|
{
|
||||||
|
packages = forEachSystem linuxSystems mkPackages;
|
||||||
|
devShells = import ./shells {
|
||||||
|
inherit inputs mkPkgs;
|
||||||
|
supportedSystems = linuxSystems;
|
||||||
|
};
|
||||||
|
|
||||||
nixosConfigurations = generateHosts "nixos";
|
nixosConfigurations = generateHosts "nixos";
|
||||||
darwinConfigurations = generateHosts "macos";
|
darwinConfigurations = generateHosts "macos";
|
||||||
@@ -76,8 +127,8 @@
|
|||||||
# diyu - ?
|
# diyu - ?
|
||||||
# tirnanog - ?
|
# tirnanog - ?
|
||||||
# valhalla - ?
|
# valhalla - ?
|
||||||
# arcadia - ?
|
# arcadia - ?
|
||||||
# elysium - ?
|
# elysium - ?
|
||||||
# empyrean - ?
|
# empyrean - ?
|
||||||
# duat - ?
|
# duat - ?
|
||||||
# sheol - ?
|
# sheol - ?
|
||||||
|
|||||||
+98
-63
@@ -1,70 +1,105 @@
|
|||||||
{ inputs, ... }: {
|
{
|
||||||
generate = { host }:
|
inputs,
|
||||||
|
mkPkgs,
|
||||||
|
supportedSystems,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
generate =
|
||||||
|
{ host }:
|
||||||
let
|
let
|
||||||
syscfg = import ./systems/${host}/cfg.nix;
|
syscfg = import ./systems/${host}/cfg.nix;
|
||||||
nameValuePair = name: value: { inherit name value; };
|
nameValuePair = name: value: { inherit name value; };
|
||||||
in ({
|
systemType = syscfg.syscfg.type or "nixos";
|
||||||
"nixos" = inputs.nixpkgs.lib.nixosSystem {
|
defaultSystem =
|
||||||
system = "x86_64-linux";
|
{
|
||||||
specialArgs = { inherit inputs; };
|
nixos = "x86_64-linux";
|
||||||
modules = [
|
macos = "x86_64-darwin";
|
||||||
./modules/shared/syscfg
|
home = "x86_64-linux";
|
||||||
./modules/shared/sops
|
}
|
||||||
./modules/nixos
|
.${systemType} or (throw "Unsupported system type: ${systemType}");
|
||||||
syscfg
|
system = syscfg.syscfg.system or defaultSystem;
|
||||||
./systems/${host}
|
checkedSystem =
|
||||||
inputs.sops-nix.nixosModules.sops
|
if builtins.elem system supportedSystems then
|
||||||
inputs.home-manager.nixosModules.home-manager
|
system
|
||||||
|
else
|
||||||
|
throw "Unsupported system '${system}' for host '${host}'";
|
||||||
|
pkgs = mkPkgs checkedSystem;
|
||||||
|
in
|
||||||
|
(
|
||||||
|
{
|
||||||
|
"nixos" = inputs.nixpkgs.lib.nixosSystem {
|
||||||
|
system = checkedSystem;
|
||||||
|
specialArgs = { inherit inputs; };
|
||||||
|
modules = [
|
||||||
|
./modules/shared/syscfg
|
||||||
|
./modules/shared/sops
|
||||||
|
./modules/nixos
|
||||||
|
syscfg
|
||||||
|
./systems/${host}
|
||||||
|
inputs.sops-nix.nixosModules.sops
|
||||||
|
inputs.home-manager.nixosModules.home-manager
|
||||||
|
|
||||||
inputs.nixos-wsl.nixosModules.wsl
|
inputs.nixos-wsl.nixosModules.wsl
|
||||||
inputs.vscode-server.nixosModules.default
|
inputs.vscode-server.nixosModules.default
|
||||||
|
|
||||||
{
|
{
|
||||||
home-manager.useGlobalPkgs = true;
|
home-manager.useGlobalPkgs = true;
|
||||||
home-manager.useUserPackages = true;
|
home-manager.useUserPackages = true;
|
||||||
home-manager.extraSpecialArgs = { inherit inputs; };
|
home-manager.extraSpecialArgs = { inherit inputs; };
|
||||||
home-manager.users = builtins.listToAttrs (map (userConfig:
|
home-manager.users = builtins.listToAttrs (
|
||||||
nameValuePair userConfig.username {
|
map (
|
||||||
imports = [
|
userConfig:
|
||||||
./modules/shared/syscfg
|
nameValuePair userConfig.username {
|
||||||
./modules/shared/colors
|
imports = [
|
||||||
./modules/home
|
./modules/shared/syscfg
|
||||||
syscfg
|
./modules/shared/colors
|
||||||
{ usercfg = userConfig; }
|
./modules/home
|
||||||
inputs.nix-colors.homeManagerModule
|
syscfg
|
||||||
inputs.sops-nix.homeManagerModules.sops
|
{ usercfg = userConfig; }
|
||||||
];
|
inputs.nix-colors.homeManagerModule
|
||||||
}) syscfg.syscfg.users);
|
inputs.sops-nix.homeManagerModules.sops
|
||||||
}
|
];
|
||||||
];
|
}
|
||||||
};
|
) (syscfg.syscfg.users or [ ])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
"macos" = inputs.darwin.lib.darwinSystem {
|
"macos" = inputs.darwin.lib.darwinSystem {
|
||||||
system = "x86_64-darwin";
|
system = checkedSystem;
|
||||||
modules = [
|
modules = [
|
||||||
./modules/shared/syscfg
|
./modules/shared/syscfg
|
||||||
./modules/shared/sops
|
./modules/shared/sops
|
||||||
syscfg
|
syscfg
|
||||||
./systems/${host}
|
./systems/${host}
|
||||||
inputs.sops-nix.nixosModules.sops
|
inputs.sops-nix.darwinModules.sops
|
||||||
inputs.home-manager.darwinModules.home-manager
|
inputs.home-manager.darwinModules.home-manager
|
||||||
{
|
{
|
||||||
home-manager.useGlobalPkgs = true;
|
home-manager.useGlobalPkgs = true;
|
||||||
home-manager.useUserPackages = true;
|
home-manager.useUserPackages = true;
|
||||||
home-manager.extraSpecialArgs = { inherit inputs; };
|
home-manager.extraSpecialArgs = { inherit inputs; };
|
||||||
home-manager.users = builtins.listToAttrs (map (userConfig:
|
home-manager.users = builtins.listToAttrs (
|
||||||
nameValuePair userConfig.username {
|
map (
|
||||||
imports = [
|
userConfig:
|
||||||
inputs.nix-colors.homeManagerModule
|
nameValuePair userConfig.username {
|
||||||
inputs.sops-nix.homeManagerModules.sops
|
imports = [
|
||||||
];
|
inputs.nix-colors.homeManagerModule
|
||||||
}) syscfg.syscfg.users);
|
inputs.sops-nix.homeManagerModules.sops
|
||||||
}
|
];
|
||||||
];
|
}
|
||||||
};
|
) (syscfg.syscfg.users or [ ])
|
||||||
"home" = inputs.home-manager.lib.homeManagerConfiguration {
|
);
|
||||||
modules = [ ./modules/home ];
|
}
|
||||||
};
|
];
|
||||||
_ = throw "Unsupported system";
|
};
|
||||||
}.${syscfg.syscfg.type});
|
"home" = inputs.home-manager.lib.homeManagerConfiguration {
|
||||||
|
inherit pkgs;
|
||||||
|
modules = [ ./modules/home ];
|
||||||
|
};
|
||||||
|
_ = throw "Unsupported system";
|
||||||
|
}
|
||||||
|
.${systemType}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ let
|
|||||||
};
|
};
|
||||||
in lib.recursiveUpdate base overrides;
|
in lib.recursiveUpdate base overrides;
|
||||||
vmBuilder = { name, vm }: ((import "${pkgs.path}/nixos/lib/eval-config.nix" {
|
vmBuilder = { name, vm }: ((import "${pkgs.path}/nixos/lib/eval-config.nix" {
|
||||||
system = "x86_64-linux";
|
system = pkgs.stdenv.hostPlatform.system;
|
||||||
modules = [ vm.cfg
|
modules = [ vm.cfg
|
||||||
({ config, lib, modulesPath, ... }: {
|
({ config, lib, modulesPath, ... }: {
|
||||||
imports = [
|
imports = [
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
let
|
let
|
||||||
isCI = builtins.elem config.syscfg.hostname [ "ci" "sandbox" ];
|
isCI = builtins.elem config.syscfg.hostname [ "ci" "sandbox" ];
|
||||||
|
defaultUser = config.users.users.${config.syscfg.defaultUser} or { };
|
||||||
|
defaultGroup = if pkgs.stdenv.isDarwin then "staff" else "users";
|
||||||
keyFilePath = (if isCI then
|
keyFilePath = (if isCI then
|
||||||
"/var/lib/sops-nix/mock-key.txt"
|
"/var/lib/sops-nix/mock-key.txt"
|
||||||
else
|
else
|
||||||
@@ -8,7 +10,7 @@ let
|
|||||||
sopsFilePath = (if isCI then ./mock.yaml else ./common.yaml);
|
sopsFilePath = (if isCI then ./mock.yaml else ./common.yaml);
|
||||||
in {
|
in {
|
||||||
environment.systemPackages = with pkgs; [ sops ];
|
environment.systemPackages = with pkgs; [ sops ];
|
||||||
environment.sessionVariables.SOPS_AGE_KEY_FILE = keyFilePath;
|
environment.variables.SOPS_AGE_KEY_FILE = keyFilePath;
|
||||||
|
|
||||||
sops.defaultSopsFile = sopsFilePath;
|
sops.defaultSopsFile = sopsFilePath;
|
||||||
sops.age.keyFile = keyFilePath;
|
sops.age.keyFile = keyFilePath;
|
||||||
@@ -19,8 +21,8 @@ in {
|
|||||||
{
|
{
|
||||||
"${config.syscfg.hostname}_ssh_priv" = {
|
"${config.syscfg.hostname}_ssh_priv" = {
|
||||||
mode = "0400";
|
mode = "0400";
|
||||||
owner = config.users.users.${config.syscfg.defaultUser}.name;
|
owner = defaultUser.name or config.syscfg.defaultUser;
|
||||||
group = config.users.users.${config.syscfg.defaultUser}.group;
|
group = defaultUser.group or defaultGroup;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
(lib.mkIf config.syscfg.net.wlp.enable {
|
(lib.mkIf config.syscfg.net.wlp.enable {
|
||||||
|
|||||||
@@ -14,6 +14,11 @@ in with lib; {
|
|||||||
type = types.enum [ "nixos" "macos" "home" ];
|
type = types.enum [ "nixos" "macos" "home" ];
|
||||||
default = "nixos";
|
default = "nixos";
|
||||||
};
|
};
|
||||||
|
system = mkOption {
|
||||||
|
type = types.enum [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
|
||||||
|
default = "x86_64-linux";
|
||||||
|
description = "Nix platform used to evaluate this host.";
|
||||||
|
};
|
||||||
defaultUser = mkOption { type = types.str; };
|
defaultUser = mkOption { type = types.str; };
|
||||||
make = import ./make.nix {inherit lib;};
|
make = import ./make.nix {inherit lib;};
|
||||||
net = import ./net.nix {inherit lib;};
|
net = import ./net.nix {inherit lib;};
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{ inputs, pkgs, ... }:
|
{ inputs, ... }:
|
||||||
[
|
[
|
||||||
(final: prev: {
|
(final: prev: {
|
||||||
#openttd-jgrpp = import ./openttd-jgrpp { inherit final prev; };
|
#openttd-jgrpp = import ./openttd-jgrpp { inherit final prev; };
|
||||||
@@ -7,9 +7,7 @@
|
|||||||
# ags = import ./ags { inherit final prev; };
|
# ags = import ./ags { inherit final prev; };
|
||||||
wine = final.unstable.wineWow64Packages.unstableFull;
|
wine = final.unstable.wineWow64Packages.unstableFull;
|
||||||
unstable = import inputs.nixUnstable {
|
unstable = import inputs.nixUnstable {
|
||||||
|
|
||||||
system = final.stdenv.hostPlatform.system;
|
system = final.stdenv.hostPlatform.system;
|
||||||
stdenv.hostPlatform.system = final.stdenv.hostPlatform.system;
|
|
||||||
config.allowUnfree = true;
|
config.allowUnfree = true;
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
{ pkgs, ... }: {
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
amdgpu_top = pkgs.callPackage ./amdgpu_top { };
|
amdgpu_top = pkgs.callPackage ./amdgpu_top { };
|
||||||
simc = pkgs.qt6.callPackage ./simc { };
|
simc = pkgs.qt6.callPackage ./simc { };
|
||||||
repalette = pkgs.callPackage ./repalette { };
|
repalette = pkgs.callPackage ./repalette { };
|
||||||
|
|||||||
+15
-9
@@ -1,13 +1,19 @@
|
|||||||
{ inputs, ... }:
|
{
|
||||||
|
inputs,
|
||||||
|
mkPkgs,
|
||||||
|
supportedSystems,
|
||||||
|
...
|
||||||
|
}:
|
||||||
let
|
let
|
||||||
forEachSystem =
|
forEachSystem = inputs.nixpkgs.lib.genAttrs supportedSystems;
|
||||||
inputs.nixpkgs.lib.genAttrs [ "aarch64-linux" "x86_64-linux" ];
|
in
|
||||||
in forEachSystem (system:
|
forEachSystem (
|
||||||
|
system:
|
||||||
let
|
let
|
||||||
overlays = import ../overlays { inherit inputs pkgs; };
|
pkgs = mkPkgs system;
|
||||||
overrides = { custom = import ../packages { inherit pkgs; }; };
|
in
|
||||||
pkgs = import inputs.nixpkgs { inherit system overlays; } // overrides;
|
{
|
||||||
in {
|
|
||||||
default = import ./devsh { inherit pkgs; };
|
default = import ./devsh { inherit pkgs; };
|
||||||
devsh = import ./devsh { inherit pkgs; };
|
devsh = import ./devsh { inherit pkgs; };
|
||||||
})
|
}
|
||||||
|
)
|
||||||
|
|||||||
@@ -3,5 +3,6 @@
|
|||||||
hostname = "asgard";
|
hostname = "asgard";
|
||||||
defaultUser = "sora";
|
defaultUser = "sora";
|
||||||
type = "macos";
|
type = "macos";
|
||||||
|
system = "x86_64-darwin";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,8 +12,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
fonts = {
|
fonts = {
|
||||||
fontDir.enable = true;
|
packages = with pkgs; [ ibm-plex openmoji-color material-design-icons ];
|
||||||
fonts = with pkgs; [ ibm-plex openmoji-color material-design-icons ];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
environment = {
|
environment = {
|
||||||
@@ -33,8 +32,6 @@
|
|||||||
|
|
||||||
programs = { zsh.enable = true; };
|
programs = { zsh.enable = true; };
|
||||||
|
|
||||||
services = { nix-daemon.enable = true; };
|
|
||||||
|
|
||||||
homebrew = {
|
homebrew = {
|
||||||
enable = true;
|
enable = true;
|
||||||
onActivation = {
|
onActivation = {
|
||||||
@@ -54,7 +51,11 @@
|
|||||||
'';
|
'';
|
||||||
gc = {
|
gc = {
|
||||||
automatic = true;
|
automatic = true;
|
||||||
dates = "weekly";
|
interval = {
|
||||||
|
Weekday = 0;
|
||||||
|
Hour = 3;
|
||||||
|
Minute = 0;
|
||||||
|
};
|
||||||
options = "--delete-older-than 7d";
|
options = "--delete-older-than 7d";
|
||||||
};
|
};
|
||||||
settings = {
|
settings = {
|
||||||
@@ -67,6 +68,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
system = {
|
system = {
|
||||||
|
primaryUser = "sora";
|
||||||
defaults = {
|
defaults = {
|
||||||
NSGlobalDomain = {
|
NSGlobalDomain = {
|
||||||
KeyRepeat = 1;
|
KeyRepeat = 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user