diff --git a/flake.lock b/flake.lock index 1e1a1cc..7e1aa01 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1702676849, - "narHash": "sha256-XqcREaTS38/QOsN8fk8PP325/UXHyF9enbP5ZPw5aiA=", + "lastModified": 1706981411, + "narHash": "sha256-cLbLPTL1CDmETVh4p0nQtvoF+FSEjsnJTFpTxhXywhQ=", "owner": "nix-community", "repo": "home-manager", - "rev": "aa99c2f4e9847cbb7e46fac0844ea1eb164b3b3a", + "rev": "652fda4ca6dafeb090943422c34ae9145787af37", "type": "github" }, "original": { @@ -23,11 +23,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1701952659, - "narHash": "sha256-TJv2srXt6fYPUjxgLAL0cy4nuf1OZD4KuA1TrCiQqg0=", + "lastModified": 1709309926, + "narHash": "sha256-VZFBtXGVD9LWTecGi6eXrE0hJ/mVB3zGUlHImUs2Qak=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "b4372c4924d9182034066c823df76d6eaf1f4ec4", + "rev": "79baff8812a0d68e24a836df0a364c678089e2c7", "type": "github" }, "original": { @@ -38,11 +38,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1702206697, - "narHash": "sha256-vE9oEx3Y8TO5MnWwFlmopjHd1JoEBno+EhsfUCq5iR8=", + "lastModified": 1709356872, + "narHash": "sha256-mvxCirJbtkP0cZ6ABdwcgTk0u3bgLoIoEFIoYBvD6+4=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "29d6c96900b9b576c2fb89491452f283aa979819", + "rev": "458b097d81f90275b3fdf03796f0563844926708", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index b770ae3..bb972dc 100644 --- a/flake.nix +++ b/flake.nix @@ -15,53 +15,46 @@ , home-manager , ... }: + let + mkHost = { hostname, user ? "sammy" }: { + + imports = [ + ./hosts/${hostname}/configuration.nix + ./modules + (import "${home-manager}/nixos") + ]; + + deployment = { + targetUser = user; + allowLocalDeployment = true; + }; + }; + in { formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra; colmena = { meta = { + description = "All my NixoS machines"; + specialArgs = { + flake = self; + }; nixpkgs = import nixpkgs { system = "x86_64-linux"; overlays = [ ]; }; }; - bengal = - { name - , nodes - , pkgs - , ... - }: { - imports = [ - ./hosts/${name}/configuration.nix - ./modules/common - (import "${home-manager}/nixos") - ]; + bengal = mkHost { hostname = "bengal"; }; - deployment = { - targetUser = "sammy"; - allowLocalDeployment = true; - }; - }; - - maine-coon = - { name - , nodes - , pkgs - , ... - }: { - imports = [ - ./hosts/${name}/configuration.nix - ./modules/common - (import "${home-manager}/nixos") - ]; - deployment = { - targetHost = "maine-coon"; - allowLocalDeployment = true; - }; - }; + maine-coon = mkHost { hostname = "maine-coon"; }; }; nixosConfigurations.test = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { + flake = self; + }; modules = [ + ./modules ./hosts/test-vm/configuration.nix (import "${home-manager}/nixos") ]; diff --git a/hosts/test-vm/configuration.nix b/hosts/test-vm/configuration.nix index ce36a78..daaf81c 100644 --- a/hosts/test-vm/configuration.nix +++ b/hosts/test-vm/configuration.nix @@ -4,13 +4,6 @@ pkgs, ... }: { - imports = [ - ../../modules/common - ../../modules/graphical - ]; - - cherrykitten.graphical.enable = false; - users.users.admin = { isNormalUser = true; extraGroups = ["wheel"]; diff --git a/modules/common/default.nix b/modules/common.nix similarity index 93% rename from modules/common/default.nix rename to modules/common.nix index 6596825..69db266 100644 --- a/modules/common/default.nix +++ b/modules/common.nix @@ -6,13 +6,6 @@ }: let cfg = config.cherrykitten.common; in { - imports = [ - ./users.nix - ./security.nix - ./yubikey.nix - ../graphical - ]; - options.cherrykitten.common = { test = lib.mkOption { type = lib.types.str; diff --git a/modules/default.nix b/modules/default.nix new file mode 100644 index 0000000..c5c05f4 --- /dev/null +++ b/modules/default.nix @@ -0,0 +1,24 @@ +{ pkgs, config, lib, ... }: +let + cfg = config.cherrykitten; +in +with lib; +{ + imports = [ + ./common.nix + ./graphical.nix + ./security.nix + ./users.nix + ./yubikey.nix + ./nvim + ./shell/fish.nix + + ]; + options.cherrykitten = { }; + + config = { + + cherrykitten.fish.enable = mkDefault true; + cherrykitten.graphical.enable = mkDefault false; + }; +} diff --git a/modules/graphical/default.nix b/modules/graphical.nix similarity index 100% rename from modules/graphical/default.nix rename to modules/graphical.nix diff --git a/modules/nvim/default.nix b/modules/nvim/default.nix index d21b22c..1204082 100644 --- a/modules/nvim/default.nix +++ b/modules/nvim/default.nix @@ -4,7 +4,7 @@ inputs, ... }: { - programs.neovim = let + home-manager.users.sammy.programs.neovim = let toLua = str: "lua << EOF\n${str}\nEOF\n"; toLuaFile = file: "lua << EOF\n${builtins.readFile file}\nEOF\n"; in { diff --git a/modules/common/security.nix b/modules/security.nix similarity index 100% rename from modules/common/security.nix rename to modules/security.nix diff --git a/modules/shell/fish.nix b/modules/shell/fish.nix new file mode 100644 index 0000000..35fa086 --- /dev/null +++ b/modules/shell/fish.nix @@ -0,0 +1,30 @@ +{ pkgs, config, lib, flake, ... }: +let + cfg = config.cherrykitten.fish; +in +with lib; +{ + + options.cherrykitten.fish.enable = mkEnableOption "Fish-Shell"; + + config = mkIf cfg.enable { + home-manager.users.sammy = { + + programs.fish = { + enable = true; + }; + + home.file = { + fish_prompt = { + source = flake + files/config/fish/functions/fish_prompt.fish; + target = ".config/fish/functions/fish_prompt.fish"; + }; + fish_right_prompt = { + source = flake + files/config/fish/functions/fish_right_prompt.fish; + target = ".config/fish/functions/fish_right_prompt.fish"; + }; + }; + + }; + }; +} diff --git a/modules/common/users.nix b/modules/users.nix similarity index 72% rename from modules/common/users.nix rename to modules/users.nix index 483c0f2..cce17a4 100644 --- a/modules/common/users.nix +++ b/modules/users.nix @@ -22,7 +22,6 @@ in }; home-manager.users.sammy = { - imports = [ ../nvim ]; home.username = "sammy"; home.homeDirectory = "/home/sammy"; home.stateVersion = "23.11"; # Please read the comment before changing. @@ -50,21 +49,6 @@ in }; }; - fish = { - enable = true; - functions = { }; - }; - }; - - home.file = { - fish_prompt = { - source = ../../files/config/fish/functions/fish_prompt.fish; - target = ".config/fish/functions/fish_prompt.fish"; - }; - fish_right_prompt = { - source = ../../files/config/fish/functions/fish_right_prompt.fish; - target = ".config/fish/functions/fish_right_prompt.fish"; - }; }; home.sessionVariables = { diff --git a/modules/common/yubikey.nix b/modules/yubikey.nix similarity index 100% rename from modules/common/yubikey.nix rename to modules/yubikey.nix