diff --git a/flake.lock b/flake.lock index 9c6ebbf..122c5fb 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,26 @@ { "nodes": { + "blueprint": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems" + }, + "locked": { + "lastModified": 1763308703, + "narHash": "sha256-O9Y+Wer8wOh+N+4kcCK5p/VLrXyX+ktk0/s3HdZvJzk=", + "owner": "numtide", + "repo": "blueprint", + "rev": "5a9bba070f801d63e2af3c9ef00b86b212429f4f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "blueprint", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -92,6 +113,7 @@ }, "root": { "inputs": { + "blueprint": "blueprint", "home-manager": "home-manager", "mysecrets": "mysecrets", "nix-vscode-extensions": "nix-vscode-extensions", @@ -119,6 +141,21 @@ "repo": "sops-nix", "type": "github" } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index c336cef..068992c 100644 --- a/flake.nix +++ b/flake.nix @@ -4,6 +4,11 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + blueprint = { + url = "github:numtide/blueprint"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + nixos-hardware.url = "github:NixOS/nixos-hardware/master"; # Secrets management @@ -28,41 +33,6 @@ }; }; - outputs = { self, nixpkgs, home-manager, ... }@inputs: let - inherit (self) outputs; - system = "x86_64-linux"; - pkgs = nixpkgs.legacyPackages.${system}; - in { - - # Custom packages and modifications, exported as overlays - overlays = import ./overlays {inherit inputs;}; + outputs = inputs: inputs.blueprint { inherit inputs; }; - nixosConfigurations = { - sesame = nixpkgs.lib.nixosSystem { - specialArgs = {inherit inputs;}; - modules = [ - ./hosts/sesame/configuration.nix - # inputs.home-manager.nixosModules.default - ]; - }; - gwiad = nixpkgs.lib.nixosSystem { - specialArgs = {inherit inputs outputs;}; - modules = [ - ./hosts/gwiad/configuration.nix - # inputs.home-manager.nixosModules.default - ]; - }; - }; - - homeConfigurations."julien" = home-manager.lib.homeManagerConfiguration { - inherit pkgs; - - # Specify your home configuration modules here, for example, - # the path to your home.nix. - modules = [ ./homes/scalizer ]; - - # Optionally use extraSpecialArgs - # to pass through arguments to home.nix - }; - }; } diff --git a/homes/common/default.nix b/homes/common/default.nix deleted file mode 100644 index 6cab159..0000000 --- a/homes/common/default.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ ... }: -{ - - imports = [ - ./user-info.nix - ./base.nix - ./editor.nix - ./vc.nix - ]; - -} diff --git a/homes/common/editor.nix b/homes/common/editor.nix deleted file mode 100644 index 441f4f0..0000000 --- a/homes/common/editor.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ config, pkgs, ... }: -{ - - programs.helix = { - enable = true; - defaultEditor = true; - }; - -} diff --git a/homes/common/user-info.nix b/homes/common/user-info.nix deleted file mode 100644 index 96f8bd1..0000000 --- a/homes/common/user-info.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ lib, ... }: -{ - - options.user.info = { - name = lib.mkOption { - type = lib.types.str; - }; - email = lib.mkOption { - type = lib.types.str; - }; - }; - - config.user.info = { - name = lib.mkDefault "Julien Hémono"; - email = lib.mkDefault "julien@hemono.fr"; - }; - -} diff --git a/homes/common/vc.nix b/homes/common/vc.nix deleted file mode 100644 index 9bbb8a3..0000000 --- a/homes/common/vc.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ config, pkgs, ... }: -{ - - programs.git = { - enable = true; - settings = { - user = { - email = config.user.info.email; - name = config.user.info.name; - }; - }; - }; - - programs.jujutsu = { - enable = true; - settings = { - user = { - email = config.user.info.email; - name = config.user.info.name; - }; - ui.default-command = "log"; - }; - }; - - programs.gh = { - enable = true; - }; - -} diff --git a/homes/scalizer/default.nix b/hosts/LAPTOP-032/users/julien.nix similarity index 72% rename from homes/scalizer/default.nix rename to hosts/LAPTOP-032/users/julien.nix index 08b24ba..fe42588 100644 --- a/homes/scalizer/default.nix +++ b/hosts/LAPTOP-032/users/julien.nix @@ -1,17 +1,15 @@ -{ config, pkgs, ... }: +{ flake, config, pkgs, ... }: { - imports = [ - ../common + imports = with flake.homeModules; [ + base + git ]; - home.username = "julien"; - home.homeDirectory = "/home/julien"; - home.stateVersion = "25.05"; - user.info.email = "julien@scalizer.fr"; + user.email = "julien@scalizer.fr"; programs.uv.enable = true; diff --git a/hosts/common/default.nix b/hosts/common/default.nix deleted file mode 100644 index b53c63e..0000000 --- a/hosts/common/default.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ ... }: -{ - - imports = [ - ./nix.nix - ]; - -} diff --git a/hosts/gwiad/configuration.nix b/hosts/gwiad/configuration.nix index dbc22a8..1bea7f3 100644 --- a/hosts/gwiad/configuration.nix +++ b/hosts/gwiad/configuration.nix @@ -1,19 +1,13 @@ -# Edit this configuration file to define what should be installed on -# your system. Help is available in the configuration.nix(5) man page, on -# https://search.nixos.org/options and in the NixOS manual (`nixos-help`). - -{ config, lib, pkgs, inputs, outputs, ... }: - +{ inputs, flake, pkgs, hostName, ... }: { - imports = - [ # Include the results of the hardware scan. - ./hardware-configuration.nix - ../common - ./home.nix - # Services - ./btrbk.nix - ./syncthing.nix - ]; + imports = with flake.nixosModules; [ + ./hardware-configuration.nix + base + jhemono + # Services + ./btrbk.nix + ./syncthing.nix + ]; # Boot configuration boot.loader.systemd-boot.enable = true; @@ -21,7 +15,7 @@ boot.loader.efi.canTouchEfiVariables = true; # Networking - networking.hostName = "gwiad"; + networking.hostName = hostName; networking.networkmanager.enable = true; # Set your time zone. @@ -32,6 +26,9 @@ keyMap = "fr"; }; + users.users.jhemono.uid = 1000; + users.groups.jhemono.gid = 1000; + # Enable CUPS to print documents. # services.printing.enable = true; diff --git a/hosts/gwiad/home.nix b/hosts/gwiad/home.nix deleted file mode 100644 index ca921ef..0000000 --- a/hosts/gwiad/home.nix +++ /dev/null @@ -1,25 +0,0 @@ -# Edit this configuration file to define what should be installed on -# your system. Help is available in the configuration.nix(5) man page, on -# https://search.nixos.org/options and in the NixOS manual (`nixos-help`). - -{ config, lib, pkgs, inputs, outputs, ... }: - -{ - imports = [ - inputs.home-manager.nixosModules.home-manager - ]; - - users.users.jhemono = { - isNormalUser = true; - uid = 1000; - extraGroups = [ "wheel" ]; # Enable 'sudo' for the user. - }; - users.groups.jhemono.gid = 1000; - - home-manager = { - useGlobalPkgs = true; - useUserPackages = true; - backupFileExtension = "bak"; - users.jhemono = ../../homes/me; - }; -} diff --git a/homes/me/default.nix b/hosts/gwiad/users/jhemono.nix similarity index 93% rename from homes/me/default.nix rename to hosts/gwiad/users/jhemono.nix index e0f747d..23ede68 100644 --- a/homes/me/default.nix +++ b/hosts/gwiad/users/jhemono.nix @@ -1,9 +1,10 @@ -{ config, pkgs, ... }: +{ flake, config, pkgs, ... }: { - imports = [ - ../common + imports = with flake.homeModules; [ + base + git ]; home.stateVersion = "25.05"; # Please read the comment before changing. diff --git a/hosts/sesame/configuration.nix b/hosts/sesame/configuration.nix index 28a5a97..82b5f9a 100644 --- a/hosts/sesame/configuration.nix +++ b/hosts/sesame/configuration.nix @@ -2,13 +2,12 @@ # your system. Help is available in the configuration.nix(5) man page, on # https://search.nixos.org/options and in the NixOS manual (`nixos-help`). -{ config, lib, pkgs, ... }: +{ flake, config, hostName, lib, pkgs, ... }: { - imports = - [ # Include the results of the hardware scan. + imports = with flake.nixosModules; [ ./hardware-configuration.nix - ../common + base # Supporting ./buckets.nix ./nginx.nix @@ -28,7 +27,7 @@ boot.loader.efi.canTouchEfiVariables = true; # Networking - networking.hostName = "sesame"; + networking.hostName = hostName; networking.domain = "hemono.fr"; # Set your time zone. diff --git a/homes/common/base.nix b/modules/home/base.nix similarity index 53% rename from homes/common/base.nix rename to modules/home/base.nix index 0f0a003..3ea8983 100644 --- a/homes/common/base.nix +++ b/modules/home/base.nix @@ -1,4 +1,3 @@ -{ config, pkgs, ... }: { programs.bash.enable = true; @@ -7,4 +6,9 @@ enable = true; }; + programs.helix = { + enable = true; + defaultEditor = true; + }; + } diff --git a/modules/home/git.nix b/modules/home/git.nix new file mode 100644 index 0000000..2309de4 --- /dev/null +++ b/modules/home/git.nix @@ -0,0 +1,26 @@ +{ flake, ... }: +{ config, ... }: +{ + + imports = [ flake.homeModules.user ]; + + programs.git = { + enable = true; + settings = { + user = config.user; + }; + }; + + programs.jujutsu = { + enable = true; + settings = { + user = config.user; + ui.default-command = "log"; + }; + }; + + programs.gh = { + enable = true; + }; + +} diff --git a/modules/home/user.nix b/modules/home/user.nix new file mode 100644 index 0000000..c1083a5 --- /dev/null +++ b/modules/home/user.nix @@ -0,0 +1,17 @@ +{ lib, ... }: +{ + + options.user = { + name = lib.mkOption { + type = lib.types.str; + description = "User full name"; + default = "Julien Hémono"; + }; + email = lib.mkOption { + type = lib.types.str; + description = "User full name"; + default = "julien@hemono.fr"; + }; + }; + +} diff --git a/hosts/common/nix.nix b/modules/nixos/base.nix similarity index 81% rename from hosts/common/nix.nix rename to modules/nixos/base.nix index ac50a2b..b3ff87b 100644 --- a/hosts/common/nix.nix +++ b/modules/nixos/base.nix @@ -1,4 +1,3 @@ -{ config, pkgs, ... }: { nix = { @@ -10,7 +9,6 @@ settings = { experimental-features = [ "nix-command" "flakes" ]; auto-optimise-store = true; - trusted-users = [ "jhemono" ]; }; channel.enable = false; }; diff --git a/modules/nixos/jhemono.nix b/modules/nixos/jhemono.nix new file mode 100644 index 0000000..e16c274 --- /dev/null +++ b/modules/nixos/jhemono.nix @@ -0,0 +1,18 @@ +{ inputs, config, lib, ... }: +let + username = "jhemono"; +in +{ + + users.users.${username} = { + description = "Julien Hémono"; + isNormalUser = true; + createHome = true; + extraGroups = [ "wheel" ]; + # openssh.authorizedKeys.keys = info.authorizedKeys; + initialPassword = "cheval"; + }; + + nix.settings.trusted-users = [ username ]; + +}