diff --git a/flake.lock b/flake.lock index d1a3f6b..1162b13 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,6 +52,28 @@ "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": 1722994187, + "narHash": "sha256-K5V2N5HkGaLpf5StNbtKBM6O9K+CYF/8F8hlGUVgiKk=", + "owner": "nix-community", + "repo": "nix-vscode-extensions", + "rev": "6fc50b0716bc415cfd1bc81bb9e198d78cd03b3d", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-vscode-extensions", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1718208800, @@ -37,6 +93,7 @@ "root": { "inputs": { "mysecrets": "mysecrets", + "nix-vscode-extensions": "nix-vscode-extensions", "nixpkgs": "nixpkgs", "sops-nix": "sops-nix" } @@ -63,6 +120,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..a044690 100644 --- a/flake.nix +++ b/flake.nix @@ -20,6 +20,11 @@ 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: { @@ -31,6 +36,13 @@ # inputs.home-manager.nixosModules.default ]; }; + gwiad = nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs;}; + 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..2d3fec9 --- /dev/null +++ b/hosts/gwiad/configuration.nix @@ -0,0 +1,151 @@ +# 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, ... }: + +{ + 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 + ]; + }; + + # 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 = vscode-with-extensions.override { + vscodeExtensions = with vscode-marketplace; [ + ms-python.python + ms-python.vscode-pylance + ms-python.debugpy + ]; + }; + 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 + ]; + }; + 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; +}