diff --git a/Makefile b/Makefile index bfd22d4..5562e25 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ boot-no-nixconf: mv /etc/nix/nix.conf_ /etc/nix/nix.conf check: - nix flake check + nix flake check --show-trace # HACK: https://github.com/nix-community/home-manager/issues/5589 fix-hm-root: @@ -45,9 +45,6 @@ show: switch: nixos-rebuild switch $(options) --flake $(flake) -trace: - nix flake check --show-trace - update: nix flake update diff --git a/flake.nix b/flake.nix index a7e27ba..cdd7a43 100644 --- a/flake.nix +++ b/flake.nix @@ -142,7 +142,7 @@ __findFile = _: p: ./${p}; # List all files in a dir. - lsFiles = path: map (f: "${path}/${f}") ( + findFiles = path: map (f: "${path}/${f}") ( builtins.filter (i: builtins.readFileType "${path}/${i}" == "regular") ( builtins.attrNames (builtins.readDir path) ) @@ -158,7 +158,7 @@ # List of modules to use by defualt for all the hosts. modules = modules ++ [ # There I put host-specific configurations. - ./host/${hostname} + ./host/${system}/${hostname} # Make a device hostname match the one from this config. { networking.hostName = hostname; } @@ -168,10 +168,10 @@ # Add modules. { imports = - (self.lsFiles ./config) ++ - (self.lsFiles ./container) ++ - (self.lsFiles ./module) ++ - (self.lsFiles ./overlay) ++ + (self.findFiles ./config) ++ + (self.findFiles ./container) ++ + (self.findFiles ./module) ++ + (self.findFiles ./overlay) ++ [ ./home/NixOs.nix ]; } @@ -210,39 +210,10 @@ }; }; - liveModules = [ - "${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix" - "${nixpkgs}/nixos/modules/installer/cd-dvd/channel.nix" - - { networking.wireless.enable = nixpkgs.lib.mkForce false; } - - # Override my settings to allow SSH logins using root password. - { services.openssh.settings.PasswordAuthentication = nixpkgs.lib.mkForce true; } - { services.openssh.settings.PermitRootLogin = nixpkgs.lib.mkForce "yes"; } - - # Disable auto-updates as they are not possible for Live ISO. - { module.autoupdate.enable = false; } - - # Base Live images also require the LTS kernel. - { module.kernel.latest = false; } - ]; - x86System = hostname: mkSystem hostname "x86_64-linux" []; - - x86LiveSystem = hostname: mkSystem hostname "x86_64-linux" liveModules; - in nixpkgs.lib.foldl' (acc: h: acc // h) {} [ - # Bellow is the list of all the hosts I currently use. - # They call the `mkSystem` function that I defined above - # with their specific parameters. - # You might be interested in `live` and `nixOnDroidConfiguration` - # for Live ISO and Android configurations respectively. - (x86System "dasha") - (x86System "desktop") - (x86System "home") - (x86System "laptop") - (x86System "work") - (x86LiveSystem "live") - ]; + in nixpkgs.lib.foldl' (acc: h: acc // h) {} ( + map (host: x86System host) (builtins.attrNames (builtins.readDir ./host/x86_64-linux)) + ); # Home manager (distro-independent). @@ -270,7 +241,7 @@ inherit self inputs secret util pkgs pkgsStable pkgsMaster; inherit (self) const __findFile; }; - modules = modules ++ (self.lsFiles ./config) ++ [ + modules = modules ++ (self.findFiles ./config) ++ [ ./home/HomeManager.nix { home.hm.enable = true; } { home.hm.username = username; } @@ -292,13 +263,8 @@ in nixpkgs.lib.foldl' (acc: h: acc // h) {} [ x86LinuxRoot (x86LinuxHome "voronind" [ - { - home.hm.package = { - android.enable = true; - core.enable = true; - common.enable = true; - }; - } + { home.hm.package.core.enable = true; } + { home.hm.package.common.enable = true; } ]) ]; diff --git a/host/live/default.nix b/host/live/default.nix deleted file mode 100644 index 2e88477..0000000 --- a/host/live/default.nix +++ /dev/null @@ -1,3 +0,0 @@ -{ ... }: { - home.nixos.enable = true; -} diff --git a/host/dasha/Filesystem.nix b/host/x86_64-linux/dasha/Filesystem.nix similarity index 100% rename from host/dasha/Filesystem.nix rename to host/x86_64-linux/dasha/Filesystem.nix diff --git a/host/dasha/default.nix b/host/x86_64-linux/dasha/default.nix similarity index 100% rename from host/dasha/default.nix rename to host/x86_64-linux/dasha/default.nix diff --git a/host/desktop/Filesystem.nix b/host/x86_64-linux/desktop/Filesystem.nix similarity index 100% rename from host/desktop/Filesystem.nix rename to host/x86_64-linux/desktop/Filesystem.nix diff --git a/host/desktop/default.nix b/host/x86_64-linux/desktop/default.nix similarity index 100% rename from host/desktop/default.nix rename to host/x86_64-linux/desktop/default.nix diff --git a/host/home/Backup.nix b/host/x86_64-linux/home/Backup.nix similarity index 100% rename from host/home/Backup.nix rename to host/x86_64-linux/home/Backup.nix diff --git a/host/home/Container.nix b/host/x86_64-linux/home/Container.nix similarity index 100% rename from host/home/Container.nix rename to host/x86_64-linux/home/Container.nix diff --git a/host/home/Filesystem.nix b/host/x86_64-linux/home/Filesystem.nix similarity index 100% rename from host/home/Filesystem.nix rename to host/x86_64-linux/home/Filesystem.nix diff --git a/host/home/Network.nix b/host/x86_64-linux/home/Network.nix similarity index 100% rename from host/home/Network.nix rename to host/x86_64-linux/home/Network.nix diff --git a/host/home/Photoprocess.nix b/host/x86_64-linux/home/Photoprocess.nix similarity index 100% rename from host/home/Photoprocess.nix rename to host/x86_64-linux/home/Photoprocess.nix diff --git a/host/home/YaMusicDownload.nix b/host/x86_64-linux/home/YaMusicDownload.nix similarity index 100% rename from host/home/YaMusicDownload.nix rename to host/x86_64-linux/home/YaMusicDownload.nix diff --git a/host/home/default.nix b/host/x86_64-linux/home/default.nix similarity index 100% rename from host/home/default.nix rename to host/x86_64-linux/home/default.nix diff --git a/host/laptop/Filesystem.nix b/host/x86_64-linux/laptop/Filesystem.nix similarity index 100% rename from host/laptop/Filesystem.nix rename to host/x86_64-linux/laptop/Filesystem.nix diff --git a/host/laptop/default.nix b/host/x86_64-linux/laptop/default.nix similarity index 100% rename from host/laptop/default.nix rename to host/x86_64-linux/laptop/default.nix diff --git a/host/x86_64-linux/live/default.nix b/host/x86_64-linux/live/default.nix new file mode 100644 index 0000000..2475aa9 --- /dev/null +++ b/host/x86_64-linux/live/default.nix @@ -0,0 +1,21 @@ +{ inputs, lib, ... }: { + imports = [ + "${inputs.nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix" + "${inputs.nixpkgs}/nixos/modules/installer/cd-dvd/channel.nix" + + { networking.wireless.enable = lib.mkForce false; } + + # Override my settings to allow SSH logins using root password. + { services.openssh.settings.PasswordAuthentication = lib.mkForce true; } + { services.openssh.settings.PermitRootLogin = lib.mkForce "yes"; } + + # Disable auto-updates as they are not possible for Live ISO. + { module.autoupdate.enable = false; } + + # Base Live images also require the LTS kernel. + { module.kernel.latest = false; } + + # Root user setup. + { home.nixos.enable = true; } + ]; +} diff --git a/host/work/Fprint.nix b/host/x86_64-linux/work/Fprint.nix similarity index 100% rename from host/work/Fprint.nix rename to host/x86_64-linux/work/Fprint.nix diff --git a/host/work/default.nix b/host/x86_64-linux/work/default.nix similarity index 100% rename from host/work/default.nix rename to host/x86_64-linux/work/default.nix