From 9f00915fcc9b7b8f67613b4ce120c24012bee02c Mon Sep 17 00:00:00 2001 From: Julien Malka Date: Fri, 5 Apr 2024 00:34:14 +0200 Subject: [PATCH] create gustave --- lib/luj.nix | 8 +++ lib/mkmachine.nix | 1 + machines/gustave/default.nix | 98 ++++++++++++++++++++++++++++++++ machines/gustave/disko.nix | 53 +++++++++++++++++ machines/gustave/hardware.nix | 18 ++++++ machines/gustave/home-julien.nix | 4 ++ 6 files changed, 182 insertions(+) create mode 100644 machines/gustave/default.nix create mode 100644 machines/gustave/disko.nix create mode 100644 machines/gustave/hardware.nix create mode 100644 machines/gustave/home-julien.nix diff --git a/lib/luj.nix b/lib/luj.nix index 03dffec..43b4971 100644 --- a/lib/luj.nix +++ b/lib/luj.nix @@ -78,6 +78,14 @@ inputs: lib: with lib; let }; + gustave = { + inherit tld; + arch = "x86_64-linux"; + nixpkgs_version = inputs.nixpkgs; + hm_version = inputs.home-manager; + }; + + core-security = { inherit tld; arch = "x86_64-linux"; diff --git a/lib/mkmachine.nix b/lib/mkmachine.nix index 42538ee..4cf0d7c 100644 --- a/lib/mkmachine.nix +++ b/lib/mkmachine.nix @@ -24,6 +24,7 @@ import "${nixpkgs}/nixos/lib/eval-config.nix" { (import "${home-manager}/nixos") (import "${inputs.nixos-mailserver}") (import "${inputs.attic}/nixos/atticd.nix") + (import "${inputs.disko}/module.nix") (import "${inputs.buildbot-nix}/nix/master.nix") (import "${inputs.buildbot-nix}/nix/worker.nix") (import inputs.lanzaboote).nixosModules.lanzaboote diff --git a/machines/gustave/default.nix b/machines/gustave/default.nix new file mode 100644 index 0000000..f756837 --- /dev/null +++ b/machines/gustave/default.nix @@ -0,0 +1,98 @@ +{ config, pkgs, ... }: + +{ + imports = + [ + # Include the results of the hardware scan. + ./hardware.nix + ./home-julien.nix + ]; + + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + + + disko = import ./disko.nix; + + networking.hostName = "nixos"; # Define your hostname. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + + # Configure network proxy if necessary + # networking.proxy.default = "http://user:password@proxy:port/"; + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + # Enable networking + networking.networkmanager.enable = true; + + # Set your time zone. + time.timeZone = "Europe/Paris"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "fr_FR.UTF-8"; + LC_IDENTIFICATION = "fr_FR.UTF-8"; + LC_MEASUREMENT = "fr_FR.UTF-8"; + LC_MONETARY = "fr_FR.UTF-8"; + LC_NAME = "fr_FR.UTF-8"; + LC_NUMERIC = "fr_FR.UTF-8"; + LC_PAPER = "fr_FR.UTF-8"; + LC_TELEPHONE = "fr_FR.UTF-8"; + LC_TIME = "fr_FR.UTF-8"; + }; + + # Configure keymap in X11 + services.xserver = { + layout = "fr"; + xkbVariant = ""; + }; + + # Configure console keymap + console.keyMap = "fr"; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.julien = { + isNormalUser = true; + description = "Julien"; + extraGroups = [ "networkmanager" "wheel" ]; + packages = with pkgs; [ ]; + }; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + # vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. + # wget + ]; + + # 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; + # }; + + # List services that you want to enable: + + # Enable the OpenSSH daemon. + services.openssh.enable = true; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "23.11"; # Did you read the comment? + +} diff --git a/machines/gustave/disko.nix b/machines/gustave/disko.nix new file mode 100644 index 0000000..2caf77e --- /dev/null +++ b/machines/gustave/disko.nix @@ -0,0 +1,53 @@ +{ + devices = { + disk = { + sda = { + type = "disk"; + device = "/dev/disk/by-diskseq/3"; + content = { + type = "gpt"; + partitions = { + ESP = { + priority = 1; + name = "ESP"; + start = "1M"; + end = "128M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + }; + root = { + size = "100%"; + content = { + type = "btrfs"; + extraArgs = [ "-f" ]; # Override existing partition + # Subvolumes must set a mountpoint in order to be mounted, + # unless their parent is mounted + subvolumes = { + # Subvolume name is different from mountpoint + "/rootfs" = { + mountpoint = "/"; + }; + # Subvolume name is the same as the mountpoint + "/persistent" = { + mountpoint = "/persistent"; + }; + "/nix" = { + mountOptions = [ "compress=zstd" "noatime" ]; + mountpoint = "/nix"; + }; + }; + + mountpoint = "/partition-root"; + + }; + }; + }; + }; + }; + }; + }; +} diff --git a/machines/gustave/hardware.nix b/machines/gustave/hardware.nix new file mode 100644 index 0000000..596671d --- /dev/null +++ b/machines/gustave/hardware.nix @@ -0,0 +1,18 @@ +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ + (modulesPath + "/profiles/qemu-guest.nix") + ]; + + boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + + networking.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} diff --git a/machines/gustave/home-julien.nix b/machines/gustave/home-julien.nix new file mode 100644 index 0000000..8b3d5a4 --- /dev/null +++ b/machines/gustave/home-julien.nix @@ -0,0 +1,4 @@ +_: +{ + luj.hmgr.julien = { }; +}