diff --git a/flake.lock b/flake.lock index 780ca37..75be683 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,39 @@ { "nodes": { + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "mysecrets": { "flake": false, "locked": { @@ -18,13 +52,35 @@ "url": "ssh://forgejo@git.hemono.fr/jhemono/nix-secrets.git" } }, + "nix-vscode-extensions": { + "inputs": { + "flake-compat": "flake-compat", + "flake-utils": "flake-utils", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1724117347, + "narHash": "sha256-/nfm6P0owPtCRjT8ktq/8OChtg2HpkrvNaDJGm9N1Lk=", + "owner": "nix-community", + "repo": "nix-vscode-extensions", + "rev": "2ef60116ef361d988317cbe52a09acfeda7d3416", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-vscode-extensions", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1718437845, - "narHash": "sha256-ZT7Oc1g4I4pHVGGjQFnewFVDRLH5cIZhEzODLz9YXeY=", + "lastModified": 1723938990, + "narHash": "sha256-9tUadhnZQbWIiYVXH8ncfGXGvkNq3Hag4RCBEMUk7MI=", "owner": "nixos", "repo": "nixpkgs", - "rev": "752c634c09ceb50c45e751f8791cb45cb3d46c9e", + "rev": "c42fcfbdfeae23e68fc520f9182dde9f38ad1890", "type": "github" }, "original": { @@ -34,10 +90,28 @@ "type": "github" } }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1723991338, + "narHash": "sha256-Grh5PF0+gootJfOJFenTTxDTYPidA3V28dqJ/WV7iis=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "8a3354191c0d7144db9756a74755672387b702ba", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "root": { "inputs": { "mysecrets": "mysecrets", + "nix-vscode-extensions": "nix-vscode-extensions", "nixpkgs": "nixpkgs", + "nixpkgs-unstable": "nixpkgs-unstable", "sops-nix": "sops-nix" } }, @@ -51,11 +125,11 @@ ] }, "locked": { - "lastModified": 1718506969, - "narHash": "sha256-Pm9I/BMQHbsucdWf6y9G3xBZh3TMlThGo4KBbeoeczg=", + "lastModified": 1723501126, + "narHash": "sha256-N9IcHgj/p1+2Pvk8P4Zc1bfrMwld5PcosVA0nL6IGdE=", "owner": "Mic92", "repo": "sops-nix", - "rev": "797ce4c1f45a85df6dd3d9abdc53f2691bea9251", + "rev": "be0eec2d27563590194a9206f551a6f73d52fa34", "type": "github" }, "original": { @@ -63,6 +137,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 e5ed6ef..1e6bfa6 100644 --- a/flake.nix +++ b/flake.nix @@ -3,6 +3,7 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05"; + nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; # Secrets management sops-nix = { @@ -20,9 +21,20 @@ url = "git+ssh://forgejo@git.hemono.fr/jhemono/nix-secrets.git?ref=main&shallow=1"; flake = false; }; + + nix-vscode-extensions = { + url = "github:nix-community/nix-vscode-extensions"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; - outputs = { self, nixpkgs, ... }@inputs: { + outputs = { self, nixpkgs, ... }@inputs: let + inherit (self) outputs; + in { + + # Custom packages and modifications, exported as overlays + overlays = import ./overlays {inherit inputs;}; + nixosConfigurations = { sesame = nixpkgs.lib.nixosSystem { specialArgs = {inherit inputs;}; @@ -31,6 +43,13 @@ # inputs.home-manager.nixosModules.default ]; }; + gwiad = nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs outputs;}; + modules = [ + ./hosts/gwiad/configuration.nix + # inputs.home-manager.nixosModules.default + ]; + }; }; }; } diff --git a/hosts/gwiad/configuration.nix b/hosts/gwiad/configuration.nix new file mode 100644 index 0000000..587a022 --- /dev/null +++ b/hosts/gwiad/configuration.nix @@ -0,0 +1,159 @@ +# 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 = + [ # Include the results of the hardware scan. + ./hardware-configuration.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; + + # Set your time zone. + time.timeZone = "Europe/Paris"; + + # Console + console = { + keyMap = "fr"; + }; + + # Sway + programs.sway = { + enable = true; + }; + programs.waybar = { + enable = true; + }; + + # Enable CUPS to print documents. + # services.printing.enable = true; + + # For VSCode + nixpkgs = { + config.allowUnfree = true; + overlays = [ + inputs.nix-vscode-extensions.overlays.default + outputs.overlays.unstable-packages + ]; + }; + + # User account + users.users.jhemono = { + isNormalUser = true; + uid = 1000; + extraGroups = [ "wheel" ]; # Enable 'sudo' for the user. + packages = with pkgs; let + tex = texlive.combine { + inherit (texlive) + scheme-basic + moderncv + fontawesome5 + pgf # For tikz.sty + multirow + arydshln; + }; + my-vscode = unstable.vscode-with-extensions.override { + vscodeExtensions = with vscode-marketplace; [ + ms-python.python + ms-python.vscode-pylance + ms-python.debugpy + ms-python.black-formatter + ms-python.isort + ]; + }; + in [ + bemenu # slurpshot + grim # slurpshot + slurp # slurpshot + imv # slurpshot + alacritty + chromium + hunspell + hunspellDicts.fr-classique + inkscape + kanshi + libreoffice-fresh + my-vscode + nixfmt + pass-wayland + pulsemixer + pwgen + tex + zathura + + # General development + poetry + pre-commit + nodejs + ]; + }; + users.groups.jhemono.gid = 1000; + + # System packages + environment.systemPackages = with pkgs; [ + android-file-transfer + android-tools + bc + git + htop + jq + ncdu + rclone + tmux + tree + unzip + vim + ]; + + programs.firefox = { + enable = true; + nativeMessagingHosts.packages = with pkgs; [ passff-host ]; + }; + programs.browserpass.enable = true; + + # Fonts + fonts.packages = with pkgs; [ + monocraft + ]; + + # GNOME + services.xserver = { + enable = true; + xkb.layout = "fr"; + displayManager.gdm.enable = true; + desktopManager.gnome.enable = true; + }; + + environment.variables.EDITOR = "vim"; + + # Nix configuration + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + nix.gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 7d"; + }; + nix.settings.auto-optimise-store = true; + + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + # programs.mtr.enable = true; + programs.gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + + + system.stateVersion = "24.05"; + +} diff --git a/hosts/gwiad/hardware-configuration.nix b/hosts/gwiad/hardware-configuration.nix new file mode 100644 index 0000000..e8dadd8 --- /dev/null +++ b/hosts/gwiad/hardware-configuration.nix @@ -0,0 +1,54 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/c0db6860-b647-42eb-943f-892dde3847b2"; + fsType = "btrfs"; + options = [ "subvol=@" ]; + }; + + boot.initrd.luks.devices."root".device = "/dev/disk/by-uuid/698c62d9-1115-4756-b812-1daae4898b83"; + + fileSystems."/home" = + { device = "/dev/disk/by-uuid/c0db6860-b647-42eb-943f-892dde3847b2"; + fsType = "btrfs"; + options = [ "subvol=@home" ]; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/16A2-B1E1"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + fileSystems."/var" = + { device = "/dev/disk/by-uuid/c0db6860-b647-42eb-943f-892dde3847b2"; + fsType = "btrfs"; + options = [ "subvol=@var" ]; + }; + + swapDevices = [ ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp1s0f0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp2s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/overlays/default.nix b/overlays/default.nix new file mode 100644 index 0000000..1d0fb57 --- /dev/null +++ b/overlays/default.nix @@ -0,0 +1,11 @@ +# This file defines overlays +{inputs, ...}: { + # When applied, the unstable nixpkgs set (declared in the flake inputs) will + # be accessible through 'pkgs.unstable' + unstable-packages = final: _prev: { + unstable = import inputs.nixpkgs-unstable { + system = final.system; + config.allowUnfree = true; + }; + }; +}