diff --git a/flake.lock b/flake.lock index 60cff00..9c6ebbf 100644 --- a/flake.lock +++ b/flake.lock @@ -1,26 +1,5 @@ { "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": [ @@ -28,11 +7,11 @@ ] }, "locked": { - "lastModified": 1764998300, - "narHash": "sha256-fZatn/KLfHLDXnF0wy7JxXqGaZmGDTVufT4o/AOlj44=", + "lastModified": 1763389499, + "narHash": "sha256-GuG3PW8U41f8XqROreZQaUvrcjQt+Gh92g16X7zBUck=", "owner": "nix-community", "repo": "home-manager", - "rev": "27a6182347ccae90a88231ae0dc5dfa7d15815bb", + "rev": "7538d965352d3bfd4c380f5b3aa618bc839a84b4", "type": "github" }, "original": { @@ -66,11 +45,11 @@ ] }, "locked": { - "lastModified": 1764986069, - "narHash": "sha256-eLl4+j7Tm37XJJhYD2bTgb3x7HDfwWAr/kayb/j0TAg=", + "lastModified": 1763344676, + "narHash": "sha256-ctBPb/ea2D+r6Q0Wy0Imakj+YE5rcTTrxOqx4DaEhc0=", "owner": "nix-community", "repo": "nix-vscode-extensions", - "rev": "999eed994566bdeffdbb1c9d4920530767e8c93e", + "rev": "3c082362bcec211e14f9b8edf10c2975c74f2d04", "type": "github" }, "original": { @@ -81,11 +60,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1764440730, - "narHash": "sha256-ZlJTNLUKQRANlLDomuRWLBCH5792x+6XUJ4YdFRjtO4=", + "lastModified": 1762847253, + "narHash": "sha256-BWWnUUT01lPwCWUvS0p6Px5UOBFeXJ8jR+ZdLX8IbrU=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "9154f4569b6cdfd3c595851a6ba51bfaa472d9f3", + "rev": "899dc449bc6428b9ee6b3b8f771ca2b0ef945ab9", "type": "github" }, "original": { @@ -97,11 +76,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1764950072, - "narHash": "sha256-BmPWzogsG2GsXZtlT+MTcAWeDK5hkbGRZTeZNW42fwA=", + "lastModified": 1763283776, + "narHash": "sha256-Y7TDFPK4GlqrKrivOcsHG8xSGqQx3A6c+i7novT85Uk=", "owner": "nixos", "repo": "nixpkgs", - "rev": "f61125a668a320878494449750330ca58b78c557", + "rev": "50a96edd8d0db6cc8db57dab6bb6d6ee1f3dc49a", "type": "github" }, "original": { @@ -113,7 +92,6 @@ }, "root": { "inputs": { - "blueprint": "blueprint", "home-manager": "home-manager", "mysecrets": "mysecrets", "nix-vscode-extensions": "nix-vscode-extensions", @@ -129,11 +107,11 @@ ] }, "locked": { - "lastModified": 1764483358, - "narHash": "sha256-EyyvCzXoHrbL467YSsQBTWWg4sR96MH1sPpKoSOelB4=", + "lastModified": 1763404987, + "narHash": "sha256-7ovXpwlWU3nAaQh0AamwNWOcoKrpn7HijyT3i6p3scc=", "owner": "Mic92", "repo": "sops-nix", - "rev": "5aca6ff67264321d47856a2ed183729271107c9c", + "rev": "e3aa38151e5c3445860c709bfc65c148fa900cdb", "type": "github" }, "original": { @@ -141,21 +119,6 @@ "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 068992c..c336cef 100644 --- a/flake.nix +++ b/flake.nix @@ -4,11 +4,6 @@ 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 @@ -33,6 +28,41 @@ }; }; - outputs = inputs: inputs.blueprint { inherit inputs; }; + 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;}; + 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/modules/home/base.nix b/homes/common/base.nix similarity index 53% rename from modules/home/base.nix rename to homes/common/base.nix index 3ea8983..0f0a003 100644 --- a/modules/home/base.nix +++ b/homes/common/base.nix @@ -1,3 +1,4 @@ +{ config, pkgs, ... }: { programs.bash.enable = true; @@ -6,9 +7,4 @@ enable = true; }; - programs.helix = { - enable = true; - defaultEditor = true; - }; - } diff --git a/homes/common/default.nix b/homes/common/default.nix new file mode 100644 index 0000000..6cab159 --- /dev/null +++ b/homes/common/default.nix @@ -0,0 +1,11 @@ +{ ... }: +{ + + imports = [ + ./user-info.nix + ./base.nix + ./editor.nix + ./vc.nix + ]; + +} diff --git a/homes/common/editor.nix b/homes/common/editor.nix new file mode 100644 index 0000000..441f4f0 --- /dev/null +++ b/homes/common/editor.nix @@ -0,0 +1,9 @@ +{ config, pkgs, ... }: +{ + + programs.helix = { + enable = true; + defaultEditor = true; + }; + +} diff --git a/homes/common/user-info.nix b/homes/common/user-info.nix new file mode 100644 index 0000000..96f8bd1 --- /dev/null +++ b/homes/common/user-info.nix @@ -0,0 +1,18 @@ +{ 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 new file mode 100644 index 0000000..9bbb8a3 --- /dev/null +++ b/homes/common/vc.nix @@ -0,0 +1,29 @@ +{ 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/hosts/gwiad/users/jhemono.nix b/homes/me/default.nix similarity index 93% rename from hosts/gwiad/users/jhemono.nix rename to homes/me/default.nix index 23ede68..e0f747d 100644 --- a/hosts/gwiad/users/jhemono.nix +++ b/homes/me/default.nix @@ -1,10 +1,9 @@ -{ flake, config, pkgs, ... }: +{ config, pkgs, ... }: { - imports = with flake.homeModules; [ - base - git + imports = [ + ../common ]; home.stateVersion = "25.05"; # Please read the comment before changing. diff --git a/hosts/LAPTOP-032/users/julien.nix b/homes/scalizer/default.nix similarity index 72% rename from hosts/LAPTOP-032/users/julien.nix rename to homes/scalizer/default.nix index fe42588..08b24ba 100644 --- a/hosts/LAPTOP-032/users/julien.nix +++ b/homes/scalizer/default.nix @@ -1,15 +1,17 @@ -{ flake, config, pkgs, ... }: +{ config, pkgs, ... }: { - imports = with flake.homeModules; [ - base - git + imports = [ + ../common ]; + home.username = "julien"; + home.homeDirectory = "/home/julien"; + home.stateVersion = "25.05"; - user.email = "julien@scalizer.fr"; + user.info.email = "julien@scalizer.fr"; programs.uv.enable = true; diff --git a/hosts/common/default.nix b/hosts/common/default.nix new file mode 100644 index 0000000..b53c63e --- /dev/null +++ b/hosts/common/default.nix @@ -0,0 +1,8 @@ +{ ... }: +{ + + imports = [ + ./nix.nix + ]; + +} diff --git a/hosts/common/nix.nix b/hosts/common/nix.nix new file mode 100644 index 0000000..ac50a2b --- /dev/null +++ b/hosts/common/nix.nix @@ -0,0 +1,18 @@ +{ config, pkgs, ... }: +{ + + nix = { + gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 7d"; + }; + settings = { + experimental-features = [ "nix-command" "flakes" ]; + auto-optimise-store = true; + trusted-users = [ "jhemono" ]; + }; + channel.enable = false; + }; + +} diff --git a/hosts/gwiad/configuration.nix b/hosts/gwiad/configuration.nix index 76e1a81..dbc22a8 100644 --- a/hosts/gwiad/configuration.nix +++ b/hosts/gwiad/configuration.nix @@ -1,19 +1,36 @@ -{ inputs, flake, pkgs, ... }: +# 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 = with flake.nixosModules; [ - ./hardware-configuration.nix - base - jhemono - # Services - ./btrbk.nix - ./syncthing.nix - ]; + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ../common + ./home.nix + # Services + ./btrbk.nix + ./syncthing.nix + ]; + + # Boot configuration + boot.loader.systemd-boot.enable = true; + boot.loader.systemd-boot.configurationLimit = 10; + boot.loader.efi.canTouchEfiVariables = true; # Networking + networking.hostName = "gwiad"; networking.networkmanager.enable = true; - users.users.jhemono.uid = 1000; - users.groups.jhemono.gid = 1000; + # Set your time zone. + time.timeZone = "Europe/Paris"; + + # Console + console = { + keyMap = "fr"; + }; # Enable CUPS to print documents. # services.printing.enable = true; @@ -29,7 +46,17 @@ # System packages environment.systemPackages = with pkgs; [ android-tools + bc + git + htop + jq + ncdu rclone + tmux + tree + unzip + vim + zip ]; virtualisation.docker.rootless = { @@ -59,6 +86,8 @@ orca ]; + environment.variables.EDITOR = "vim"; + # Some programs need SUID wrappers, can be configured further or are # started in user sessions. # programs.mtr.enable = true; diff --git a/hosts/gwiad/home.nix b/hosts/gwiad/home.nix new file mode 100644 index 0000000..ca921ef --- /dev/null +++ b/hosts/gwiad/home.nix @@ -0,0 +1,25 @@ +# 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/hosts/sesame/configuration.nix b/hosts/sesame/configuration.nix index b34f344..28a5a97 100644 --- a/hosts/sesame/configuration.nix +++ b/hosts/sesame/configuration.nix @@ -2,13 +2,13 @@ # 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`). -{ flake, config, lib, pkgs, ... }: +{ config, lib, pkgs, ... }: { - imports = with flake.nixosModules; [ + imports = + [ # Include the results of the hardware scan. ./hardware-configuration.nix - base - jhemono + ../common # Supporting ./buckets.nix ./nginx.nix @@ -22,11 +22,54 @@ ./syncthing.nix ]; + # Boot configuration + boot.loader.systemd-boot.enable = true; + boot.loader.systemd-boot.configurationLimit = 10; + boot.loader.efi.canTouchEfiVariables = true; + + # Networking + networking.hostName = "sesame"; + networking.domain = "hemono.fr"; + + # Set your time zone. + time.timeZone = "Europe/Paris"; + + # Console + console = { + keyMap = "fr"; + }; + + # User account + users.users.jhemono = { + isNormalUser = true; + extraGroups = [ "wheel" ]; # Enable 'sudo' for the user. + openssh = { + authorizedKeys.keys = [ + "ssh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GCKMv9v51dUJ5pgHxWyZZQhYNFpE2qTj8meExBDfnnYl7MFQ3j termbot" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAxc+ov8QKWxdGq3kgGqouGd7nExXgpQtZrjv2TR6ILk jhemono@ipad-fred" + ]; + }; + # packages = with pkgs; [ + # firefox + # tree + # ]; + }; + # System packages environment.systemPackages = with pkgs; [ git + htop + jq + ncdu + tmux + tree + unzip + vim ]; + environment.variables.EDITOR = "vim"; + # OpenSSH services.openssh = { enable = true; diff --git a/modules/home/git.nix b/modules/home/git.nix deleted file mode 100644 index 2309de4..0000000 --- a/modules/home/git.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ 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 deleted file mode 100644 index c1083a5..0000000 --- a/modules/home/user.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ 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/modules/nixos/base.nix b/modules/nixos/base.nix deleted file mode 100644 index 573f2a3..0000000 --- a/modules/nixos/base.nix +++ /dev/null @@ -1,46 +0,0 @@ -{ pkgs, hostName, ... }: -{ - - # Boot configuration - boot.loader.systemd-boot.enable = true; - boot.loader.systemd-boot.configurationLimit = 10; - boot.loader.efi.canTouchEfiVariables = true; - - # Networking - networking.hostName = hostName; - networking.domain = "hemono.fr"; - - # Time Zone - time.timeZone = "Europe/Paris"; - - # Console - console.keyMap = "fr"; - - # System packages - environment.systemPackages = with pkgs; [ - htop - jq - ncdu - tmux - tree - unzip - vim - zip - ]; - - environment.variables.EDITOR = "vim"; - - nix = { - gc = { - automatic = true; - dates = "weekly"; - options = "--delete-older-than 7d"; - }; - settings = { - experimental-features = [ "nix-command" "flakes" ]; - auto-optimise-store = true; - }; - channel.enable = false; - }; - -} diff --git a/modules/nixos/jhemono.nix b/modules/nixos/jhemono.nix deleted file mode 100644 index c42c990..0000000 --- a/modules/nixos/jhemono.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ inputs, config, lib, ... }: -let - username = "jhemono"; -in -{ - - users.users.${username} = { - description = "Julien Hémono"; - isNormalUser = true; - extraGroups = [ "wheel" ]; - openssh.authorizedKeys.keys = [ - "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC8Q2lWsqvoqoIxqb8HM96IpvZkFhnwcPdEo+m5peH5N/0PZloEp/NfLbzktXGNACe+bwfweR1Kokjs/Ep0tQQggGtgqB0jAopd1Yw0wzlFWYGqJsGyuFBGP4SljsQvGhU2IwgvuJFIRrOVu+gRTIM1DYGQOveNqlRU/QoqOZDQPvHsoQCLvwmZBzzi7DLktBQZ7h/CJ3GrzD2YUuIyulZGbhfM86i0p7NQ5+TSxuo7Yotbwzrzi7hAROO22ghRfv0vxAPip9SCF1SKIZpSDd8s7Nk6dkDE+95N5cMOkFwokWWsxaTM+EgZfTjQZon1L1/X3UC3hK6C+7GLusoNe8xdjm14e9LA5qG5ZRtLrmIrI2bW5KBj/8iTxRmXpE9x70d2Hl6jtHBQv4rQOAO3BET0TjlNAXchNDOcDbNX1ZqEwyImoF4c3kbr5M2ezWCDltAdvd74mMMiaenxwYkZeZbR3EJPbtC1v//9QQ9S7OzKa5utwjhZFlh0g79GKq8DiU6W8IzzmD7pGi8MIV3wOh1NGlcIlPaIyJY60XN0iRNI9NhMASAF493xPfMlVWl7Tly1VDVcPp5pC47vHU6/2mBbx5tnVShNPnkf4OwF3nC8i0DT+dRKXAxjfpoM5iYIrSHrNj9EKKFE4qNbqtAPTNGGtxJ0fUdWOgXLf5BMfYmaiQ== jhemono@gwiad" - "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDFWZ1MF5Srp1AkfgzO/19RCeYfCU+HtJFYESS9PhQrQYhUwZtoHExHYyD1nf71+jGFu6HJjXAPDD5ZW1XqYEh8kFvkx8uXw+kKHOVwuVhkcIYduQlsR8e8kbu8y6OABPe3SWmmtiA2HdWCwlZNoyTL1X4+LsA+Hbs0EHn1p+RQ4YeOSuZV/5VETt1Mcu/d0GyFBlnoCtu3VwexBdZgsVkw/kOpjNrY0RhqEwiO7P9J+jXT6HB8wvus6MzgvNPzoFo6hAXqRGu3SvCQJnVkE/AulHBfWLFCwdIrekGCKMv9v51dUJ5pgHxWyZZQhYNFpE2qTj8meExBDfnnYl7MFQ3j termbot" - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAxc+ov8QKWxdGq3kgGqouGd7nExXgpQtZrjv2TR6ILk jhemono@ipad-fred" - ]; - initialPassword = "cheval"; - }; - - nix.settings.trusted-users = [ username ]; - -}