diff options
| author | seth <[email protected]> | 2024-10-18 03:10:35 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-10-18 07:10:35 +0000 |
| commit | e6f79b30e620cf7bd5b06e2579e979ff090e925a (patch) | |
| tree | 1dd2b20126602ef448f77fbb9cdd44ba7f02a58c /modules | |
| parent | fdaf8680ef5bbcadb7cece43911beff18f90cdb2 (diff) | |
more refactors & outsource some things (#477)
* tree-wide: drop flake-parts
* drop nixinate
* justfile: cleanup
* drop treefmt-nix
* doc: update READMEs
* flake: cleanup
* seth: don't use `./.`
* modules/nixos,darwin: bundle all modules
They all depend on each other anyways so
* systems: manually import internal modules
* seth: use riff module from nix-exprs
* flake: back to flake-parts
* Revert "flake: back to flake-parts"
This reverts commit 35334882f7c0c23991a4efd65ea08b216006b2b0.
Saving the last commit so I can go back if I want
* flake: use lib.const
this looks better...right?
* flake: declare systems like a normal person
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/darwin/base/default.nix | 1 | ||||
| -rw-r--r-- | modules/darwin/default.nix | 13 | ||||
| -rw-r--r-- | modules/default.nix | 8 | ||||
| -rw-r--r-- | modules/flake/default.nix | 12 | ||||
| -rw-r--r-- | modules/flake/map-configs.nix | 191 | ||||
| -rw-r--r-- | modules/home/default.nix | 5 | ||||
| -rw-r--r-- | modules/home/riff.nix | 49 | ||||
| -rw-r--r-- | modules/nixos/archetypes/personal.nix | 7 | ||||
| -rw-r--r-- | modules/nixos/archetypes/server.nix | 7 | ||||
| -rw-r--r-- | modules/nixos/base/default.nix | 1 | ||||
| -rw-r--r-- | modules/nixos/default.nix | 15 | ||||
| -rw-r--r-- | modules/nixos/traits/locale.nix | 4 | ||||
| -rw-r--r-- | modules/shared/traits/locale.nix | 4 |
13 files changed, 23 insertions, 294 deletions
diff --git a/modules/darwin/base/default.nix b/modules/darwin/base/default.nix index e9ab743..7e6f3bd 100644 --- a/modules/darwin/base/default.nix +++ b/modules/darwin/base/default.nix @@ -4,7 +4,6 @@ let in { imports = [ - ../../shared ./programs.nix ]; diff --git a/modules/darwin/default.nix b/modules/darwin/default.nix index 97f25d5..e19f29a 100644 --- a/modules/darwin/default.nix +++ b/modules/darwin/default.nix @@ -1,8 +1,9 @@ { - flake.darwinModules = { - archetypes = ./archetypes; - base = ./base; - desktop = ./desktop; - traits = ./traits; - }; + imports = [ + ../shared + ./archetypes + ./base + ./desktop + ./traits + ]; } diff --git a/modules/default.nix b/modules/default.nix deleted file mode 100644 index a91a36b..0000000 --- a/modules/default.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ - imports = [ - ./darwin - ./home - ./nixos - ./flake - ]; -} diff --git a/modules/flake/default.nix b/modules/flake/default.nix deleted file mode 100644 index d06026d..0000000 --- a/modules/flake/default.nix +++ /dev/null @@ -1,12 +0,0 @@ -let - flakeModules = { - map-configs = ./map-configs.nix; - }; -in -{ - imports = [ flakeModules.map-configs ]; - - flake = { - inherit flakeModules; - }; -} diff --git a/modules/flake/map-configs.nix b/modules/flake/map-configs.nix deleted file mode 100644 index e7733f3..0000000 --- a/modules/flake/map-configs.nix +++ /dev/null @@ -1,191 +0,0 @@ -{ - config, - lib, - withSystem, - inputs, - self, - ... -}: -let - nixosSystem = - { - nixpkgs, - modules, - specialArgs, - ... - }@args: - nixpkgs.lib.nixosSystem ( - lib.removeAttrs args [ "nixpkgs" ] - // { - modules = modules ++ builtins.attrValues (self.nixosModules or [ ]); - specialArgs = specialArgs // { - inherit inputs; - }; - } - ); - - darwinSystem = - { - nix-darwin, - modules, - specialArgs, - ... - }@args: - nix-darwin.lib.darwinSystem ( - lib.removeAttrs args [ "nix-darwin" ] - // { - modules = modules ++ builtins.attrValues (self.darwinModules or { }); - specialArgs = specialArgs // { - inherit inputs; - }; - } - ); - - homeManagerConfiguration = - { - modules, - extraSpecialArgs, - ... - }@args: - inputs.home-manager.lib.homeManagerConfiguration ( - args - // { - modules = modules ++ builtins.attrValues (self.homeModules or self.homeManagerModules or { }); - extraSpecialArgs = extraSpecialArgs // { - inherit inputs; - }; - } - ); - - modulesOption = lib.mkOption { - type = lib.types.listOf lib.types.unspecified; - default = [ ]; - description = '' - List of modules to use in the configuration - ''; - }; - - specialArgsOption = lib.mkOption { - type = lib.types.lazyAttrsOf lib.types.raw; - default = { }; - description = '' - Extra arguments to pass to the configuration - ''; - }; - - freeformType = lib.types.attrsOf lib.types.raw; - - nixosConfigurationSubmodule = { - inherit freeformType; - - options = { - nixpkgs = lib.mkOption { - type = lib.types.lazyAttrsOf lib.types.raw; - default = inputs.nixpkgs or (throw "Could not find flake input `nixpkgs`"); - description = '' - Instance of nixpkgs to use `lib.nixosSystem` from - ''; - example = lib.literalExpression '' - inputs.nixpkgs-stable - ''; - }; - - modules = modulesOption; - specialArgs = specialArgsOption; - }; - }; - - homeConfigurationSubmodule = { - inherit freeformType; - - options = { - pkgs = lib.mkOption { - type = lib.types.lazyAttrsOf lib.types.raw; - default = withSystem "x86_64-linux" ({ pkgs, ... }: pkgs); - description = '' - Instance of nixpkgs to use with the configuration - ''; - example = lib.literalExpression '' - inputs.nixpkgs.legacyPackages.aarch64-darwin - ''; - }; - - modules = modulesOption; - extraSpecialArgs = specialArgsOption; - }; - }; - - darwinConfigurationSubmodule = { - inherit freeformType; - - options = { - nix-darwin = lib.mkOption { - type = lib.types.lazyAttrsOf lib.types.raw; - default = - inputs.nix-darwin or inputs.darwin - or (throw "Could not find flake input `nixpkgs` or `nix-darwin`"); - description = '' - Instance of nix-darwin to use `lib.nix-darwin` from - ''; - }; - - modules = modulesOption; - specialArgs = specialArgsOption; - }; - }; -in - -{ - options = { - nixosConfigurations = lib.mkOption { - type = lib.types.lazyAttrsOf (lib.types.submodule nixosConfigurationSubmodule); - default = { }; - apply = lib.mapAttrs (lib.const nixosSystem); - description = '' - Map of configuration names and arguments to `nixosSystem` - ''; - example = lib.literalExpression '' - { - my-machine = { modules = [ ./configuration.nix ]; }; - } - ''; - }; - - homeConfigurations = lib.mkOption { - type = lib.types.lazyAttrsOf (lib.types.submodule homeConfigurationSubmodule); - default = { }; - apply = lib.mapAttrs (lib.const homeManagerConfiguration); - description = '' - Map of configuration names and arguments to `homeManagerConfiguration` - ''; - example = lib.literalExpression '' - { - me = { pkgs = nixpkgs.legacyPackages.x86_64-linux; }; - } - ''; - }; - - darwinConfigurations = lib.mkOption { - type = lib.types.lazyAttrsOf (lib.types.submodule darwinConfigurationSubmodule); - default = { }; - apply = lib.mapAttrs (lib.const darwinSystem); - description = '' - Map of configuration names and arguments to `darwinSystem` - ''; - example = lib.literalExpression '' - { - my-mac = { modules = [ ./darwin-configuration.nix ]; }; - } - ''; - }; - }; - - config.flake = { - inherit (config) nixosConfigurations homeConfigurations darwinConfigurations; - /* - nixosConfigurations = lib.mapAttrs (lib.const nixosSystem) config.nixosConfigurations; - homeConfigurations = lib.mapAttrs (lib.const homeManagerConfiguration) config.homeConfigurations; - darwinConfigurations = lib.mapAttrs (lib.const darwinSystem) config.darwinConfigurations; - */ - }; -} diff --git a/modules/home/default.nix b/modules/home/default.nix deleted file mode 100644 index 408e172..0000000 --- a/modules/home/default.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ - flake.homeModules = { - riff = ./riff.nix; - }; -} diff --git a/modules/home/riff.nix b/modules/home/riff.nix deleted file mode 100644 index 3a3e748..0000000 --- a/modules/home/riff.nix +++ /dev/null @@ -1,49 +0,0 @@ -# TODO: Upstream this -{ - config, - lib, - pkgs, - ... -}: -let - cfg = config.programs.git.riff; - cfg' = config.programs.git; - - exe = baseNameOf (lib.getExe cfg.package); -in -{ - options.programs.git.riff = { - enable = lib.mkEnableOption "diff filtering through riff"; - package = lib.mkPackageOption pkgs "riffdiff" { }; - }; - - config = lib.mkIf cfg.enable { - assertions = [ - { - assertion = - let - enabled = [ - cfg'.delta.enable - cfg'.diff-so-fancy.enable - cfg'.difftastic.enable - cfg.enable - ]; - in - lib.count lib.id enabled <= 1; - message = "Only one of 'programs.git.delta.enable' or 'programs.git.difftastic.enable' or 'programs.git.diff-so-fancy.enable' or `programs.git.riff.enable` can be set to true at the same time."; - } - ]; - - home.packages = [ cfg.package ]; - - programs.git.iniContent = { - pager = { - diff = exe; - log = exe; - show = exe; - }; - - interactive.diffFilter = exe + " --color=on"; - }; - }; -} diff --git a/modules/nixos/archetypes/personal.nix b/modules/nixos/archetypes/personal.nix index 1fa2f98..4200269 100644 --- a/modules/nixos/archetypes/personal.nix +++ b/modules/nixos/archetypes/personal.nix @@ -4,7 +4,7 @@ let in { options.archetypes = { - personal.enable = lib.mkEnableOption "the \"Personal\" archetype"; + personal.enable = lib.mkEnableOption "the Personal archetype"; }; config = lib.mkIf cfg.enable { @@ -13,11 +13,6 @@ in traits = { home-manager.enable = true; - locale = { - en_US.enable = true; - US-east.enable = true; - }; - secrets.enable = true; tailscale.enable = true; diff --git a/modules/nixos/archetypes/server.nix b/modules/nixos/archetypes/server.nix index 3a057d1..4dfbf9e 100644 --- a/modules/nixos/archetypes/server.nix +++ b/modules/nixos/archetypes/server.nix @@ -4,7 +4,7 @@ let in { options.archetypes = { - server.enable = lib.mkEnableOption "the \"Server\" archetype"; + server.enable = lib.mkEnableOption "the Server archetype"; }; config = lib.mkIf cfg.enable { @@ -25,11 +25,6 @@ in traits = { autoUpgrade.enable = true; - locale = { - en_US.enable = true; - US-east.enable = true; - }; - secrets.enable = true; tailscale = { diff --git a/modules/nixos/base/default.nix b/modules/nixos/base/default.nix index 30e75d9..3a6412e 100644 --- a/modules/nixos/base/default.nix +++ b/modules/nixos/base/default.nix @@ -9,7 +9,6 @@ let in { imports = [ - ../../shared ./networking.nix ./nix.nix ./programs.nix diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index b0e3664..acc9d59 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -1,9 +1,10 @@ { - flake.nixosModules = { - archetypes = ./archetypes; - base = ./base; - desktop = ./desktop; - server = ./server; - traits = ./traits; - }; + imports = [ + ../shared + ./archetypes + ./base + ./desktop + ./server + ./traits + ]; } diff --git a/modules/nixos/traits/locale.nix b/modules/nixos/traits/locale.nix index bd30819..aa103e2 100644 --- a/modules/nixos/traits/locale.nix +++ b/modules/nixos/traits/locale.nix @@ -5,7 +5,9 @@ in { options.traits.locale = { en_US = { - enable = lib.mkEnableOption "en_US locale"; + enable = lib.mkEnableOption "en_US locale" // { + default = true; + }; }; }; diff --git a/modules/shared/traits/locale.nix b/modules/shared/traits/locale.nix index a260988..3d0973c 100644 --- a/modules/shared/traits/locale.nix +++ b/modules/shared/traits/locale.nix @@ -5,7 +5,9 @@ in { options.traits.locale = { US-east = { - enable = lib.mkEnableOption "eastern United States locale"; + enable = lib.mkEnableOption "eastern United States locale" // { + default = true; + }; }; }; |
