From 9e6fd4dc9593fc4d4189dba66e152854d487a02a Mon Sep 17 00:00:00 2001 From: vali Date: Wed, 10 Apr 2024 11:35:09 +0200 Subject: [PATCH] set up something working (hopefully) --- flake.lock | 296 ++++++++++++++++++ flake.nix | 35 ++- homes/vali/vdesktop.nix | 13 + homes/vali/vlaptop.nix | 0 hosts/common/default.nix | 62 ++++ hosts/common/packages.nix | 22 ++ hosts/vali/desktop/boot.nix | 11 + hosts/vali/desktop/default.nix | 16 + hosts/vali/desktop/hardware-configuration.nix | 41 +++ hosts/vali/desktop/packages.nix | 26 ++ hosts/vali/laptop/default.nix | 0 hosts/vali/laptop/hardware-configuration.nix | 0 hosts/vali/laptop/packages.nix | 0 modules/vali/core/boot/boot.nix | 12 + modules/vali/default.nix | 9 + modules/vali/graphics/default.nix | 6 + modules/vali/graphics/wms/i3wm.nix | 28 ++ modules/vali/terminal/st.nix | 0 modules/vali/terminal/starship.nix | 0 modules/vali/terminal/zsh.nix | 0 modules/vali/web/schizofox.nix | 0 21 files changed, 567 insertions(+), 10 deletions(-) create mode 100644 flake.lock create mode 100644 homes/vali/vdesktop.nix create mode 100644 homes/vali/vlaptop.nix create mode 100644 hosts/common/default.nix create mode 100644 hosts/common/packages.nix create mode 100644 hosts/vali/desktop/boot.nix create mode 100644 hosts/vali/desktop/default.nix create mode 100644 hosts/vali/desktop/hardware-configuration.nix create mode 100644 hosts/vali/desktop/packages.nix create mode 100644 hosts/vali/laptop/default.nix create mode 100644 hosts/vali/laptop/hardware-configuration.nix create mode 100644 hosts/vali/laptop/packages.nix create mode 100644 modules/vali/core/boot/boot.nix create mode 100644 modules/vali/default.nix create mode 100644 modules/vali/graphics/default.nix create mode 100644 modules/vali/graphics/wms/i3wm.nix create mode 100644 modules/vali/terminal/st.nix create mode 100644 modules/vali/terminal/starship.nix create mode 100644 modules/vali/terminal/zsh.nix create mode 100644 modules/vali/web/schizofox.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..2b0418b --- /dev/null +++ b/flake.lock @@ -0,0 +1,296 @@ +{ + "nodes": { + "crane": { + "inputs": { + "nixpkgs": [ + "schizofox", + "searx-randomizer", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1701386725, + "narHash": "sha256-w4aBlMYh9Y8co1V80m5LzEKMijUJ7CBTq209WbqVwUU=", + "owner": "ipetkov", + "repo": "crane", + "rev": "8b9bad9b30bd7a9ed08782e64846b7485f9d0a38", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "type": "github" + } + }, + "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-parts": { + "inputs": { + "nixpkgs-lib": [ + "schizofox", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1706830856, + "narHash": "sha256-a0NYyp+h9hlb7ddVz4LUn1vT/PLwqfrWYcHMvFB1xYg=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "b253292d9c0a5ead9bc98c4e9a26c6312e27d69f", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1698882062, + "narHash": "sha256-HkhafUayIqxXyHH1X8d9RDl1M2CkFgZLjKD3MzabiEo=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "8c9fa2545007b49a5db5f650ae91f227672c3877", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "hercules-ci-effects": { + "inputs": { + "flake-parts": [ + "schizofox", + "nixpak", + "flake-parts" + ], + "nixpkgs": [ + "schizofox", + "nixpak", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1704029560, + "narHash": "sha256-a4Iu7x1OP+uSYpqadOu8VCPY+MPF3+f6KIi+MAxlgyw=", + "owner": "hercules-ci", + "repo": "hercules-ci-effects", + "rev": "d5cbf433a6ae9cae05400189a8dbc6412a03ba16", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "hercules-ci-effects", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1712730572, + "narHash": "sha256-rAVvdP77rEmgobvSgybqPAcHefv5dCXPH/ge6Ds+JtU=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "18f89ef74f0d48635488ccd6a5e30dc9d48a3a87", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "home-manager_2": { + "inputs": { + "nixpkgs": [ + "schizofox", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1708591310, + "narHash": "sha256-8mQGVs8JccWTnORgoLOTh9zvf6Np+x2JzhIc+LDcJ9s=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "0e0e9669547e45ea6cca2de4044c1a384fd0fe55", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nixpak": { + "inputs": { + "flake-parts": [ + "schizofox", + "flake-parts" + ], + "hercules-ci-effects": "hercules-ci-effects", + "nixpkgs": [ + "schizofox", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1708597894, + "narHash": "sha256-KxpKOBDGPJ76k37vLukYHp/wd7U4DoUVIvy8atHfy/k=", + "owner": "nixpak", + "repo": "nixpak", + "rev": "535dd408c4b19f407bc22e42eb32ccb9256e5865", + "type": "github" + }, + "original": { + "owner": "nixpak", + "repo": "nixpak", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1712608508, + "narHash": "sha256-vMZ5603yU0wxgyQeHJryOI+O61yrX2AHwY6LOFyV1gM=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "4cba8b53da471aea2ab2b0c1f30a81e7c451f4b6", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "dir": "lib", + "lastModified": 1698611440, + "narHash": "sha256-jPjHjrerhYDy3q9+s5EAsuhyhuknNfowY6yt6pjn9pc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "0cbe9f69c234a7700596e943bfae7ef27a31b735", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1708475490, + "narHash": "sha256-g1v0TsWBQPX97ziznfJdWhgMyMGtoBFs102xSYO4syU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "0e74ca98a74bc7270d28838369593635a5db3260", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nur": { + "locked": { + "lastModified": 1712739743, + "narHash": "sha256-S2BLkb/3oQrtiuYN7KcNZotStRU+M5u9dS7yq6SSXvY=", + "owner": "nix-community", + "repo": "NUR", + "rev": "d5602f3c52be97c9b1e50fdac3f8629808d3dcb9", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "NUR", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs", + "nur": "nur", + "schizofox": "schizofox" + } + }, + "schizofox": { + "inputs": { + "flake-compat": "flake-compat", + "flake-parts": "flake-parts", + "home-manager": "home-manager_2", + "nixpak": "nixpak", + "nixpkgs": "nixpkgs_2", + "searx-randomizer": "searx-randomizer" + }, + "locked": { + "lastModified": 1710502118, + "narHash": "sha256-kPzvCwGVuLlPDVRD35dMnudWPpEzRXfU/9DHsG12PaY=", + "owner": "schizofox", + "repo": "schizofox", + "rev": "8dde2033a6f448c48a48d4d0aeb22bf2da840b7d", + "type": "github" + }, + "original": { + "owner": "schizofox", + "repo": "schizofox", + "type": "github" + } + }, + "searx-randomizer": { + "inputs": { + "crane": "crane", + "flake-parts": "flake-parts_2", + "nixpkgs": [ + "schizofox", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1704412376, + "narHash": "sha256-Ap/AudJxCYBDWYy0lyqP0/FZYJCibL7jKkoj6hp1WS0=", + "owner": "schizofox", + "repo": "searx-randomizer", + "rev": "c36a473732ba6b4f6024ac1c181631cf4d542b17", + "type": "github" + }, + "original": { + "owner": "schizofox", + "repo": "searx-randomizer", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix index 4f158a8..68bf6db 100644 --- a/flake.nix +++ b/flake.nix @@ -2,38 +2,53 @@ description = "Our NixOS config lol"; inputs = { - nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nur.url = "github:nix-community/NUR"; schizofox.url = "github:schizofox/schizofox"; - flake-parts = { - url = "github:hercules-ci/flake-parts"; - inputs.nixpkgs.lib.follows = "nixpkgs"; - }; home-manager = { url = "github:nix-community/home-manager/"; inputs.nixpkgs.follows = "nixpkgs"; }; }; - outputs = inputs @ { self, nixpkgs, nur, home-manager, ... }: { + outputs = inputs @ { self, nixpkgs, nur, home-manager, ... }: + let + inherit (self) outputs; + mkSystem = { + hostname, + modules ? [], + user-configs ? [], + system ? "x86_64-linux" + }: + let + profile-config = { inherit hostname system modules user-configs; }; + in + nixpkgs.lib.nixosSystem { + inherit modules; + specialArgs = { inherit inputs outputs profile-config; }; + }; + mkHome = user: modules: pkgs: home-manager.lib.homeManagerConfiguration { + inherit modules pkgs user; + extraSpecialArgs = { inherit inputs outputs user; }; + }; in { nixpkgs.config.allowUnfree = true; nixosConfigurations = { vlaptop = mkSystem { hostname = "nixos"; - modules = [./hosts/laptop]; + modules = [./hosts/vali/laptop]; user-configs = [{ name = "vali"; - config = ./home/vali/laptop.nix; + config = ./homes/vali/vlaptop.nix; }]; }; vdesktop = mkSystem { hostname = "nixos"; - modules = [ ./hosts/xfce ]; + modules = [ ./hosts/vali/desktop]; user-configs = [{ name = "vali"; - config = ./home/vali/xfce.nix; + config = ./home/vali/vdesktop.nix; }]; }; }; diff --git a/homes/vali/vdesktop.nix b/homes/vali/vdesktop.nix new file mode 100644 index 0000000..6b4123f --- /dev/null +++ b/homes/vali/vdesktop.nix @@ -0,0 +1,13 @@ +{ inputs, outputs, pkgs, user, ... }: +{ + imports = [ + + ]; + xdg.configHome = "/home/${user}/.config/"; + programs.home-manager.enable = true; + home = { + stateVersion = "23.11"; + username = "${user}"; + homeDirectory = "/home/${user}"; + }; + } diff --git a/homes/vali/vlaptop.nix b/homes/vali/vlaptop.nix new file mode 100644 index 0000000..e69de29 diff --git a/hosts/common/default.nix b/hosts/common/default.nix new file mode 100644 index 0000000..8b227d3 --- /dev/null +++ b/hosts/common/default.nix @@ -0,0 +1,62 @@ +{ inputs, outputs, profile-config, pkgs, ... }: + +{ + imports = [ + #profile-config.overlays + inputs.home-manager.nixosModules.home-manager + ./packages.nix + ]; + + services.locate = { + enable = true; + interval = "daily"; + package = pkgs.plocate; + localuser = null; + }; + + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + + home-manager.users = builtins.listToAttrs (builtins.map( + u-conf: { + inherit inputs; + name = u-conf.name; + value = import u-conf.config { inherit pkgs inputs outputs; user = u-conf.name; }; + } + )profile-config.user-configs); + + users.users = builtins.listToAttrs (builtins.map( + u-conf: { + name = u-conf.name; + value = { + initialPassword = "${u-conf.name}"; + isNormalUser = true; + extraGroups = [ "wheel" "audio" "video" "input"]; + }; + } + )profile-config.user-configs); + + time.timeZone = "Europe/Zurich"; + i18n.defaultLocale = "en_US.UTF-8"; + documentation.nixos.enable = false; + # Set the keyboard layout to german + # Eable CUPS + services.printing.enable = true; + # Sound settings + sound.enable = true; + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + jack.enable = true; + pulse.enable = true; + wireplumber.enable = true; + alsa.support32Bit = true; + }; + nix = { + package = pkgs.nixFlakes; + extraOptions = "experimental-features = nix-command flakes"; + }; + system.stateVersion = "23.11"; +} diff --git a/hosts/common/packages.nix b/hosts/common/packages.nix new file mode 100644 index 0000000..3553785 --- /dev/null +++ b/hosts/common/packages.nix @@ -0,0 +1,22 @@ +{ inputs, outputs, profile-config, pkgs, ... }: + +{ + environment.systemPackages = with pkgs; [ + vim + neovim + eza + zsh + git + zip + unzip + neofetch + fastfetch + wget + zoxide + python3 + gcc + htop + networkmanager + uwufetch + ]; +} diff --git a/hosts/vali/desktop/boot.nix b/hosts/vali/desktop/boot.nix new file mode 100644 index 0000000..6ab4bde --- /dev/null +++ b/hosts/vali/desktop/boot.nix @@ -0,0 +1,11 @@ +{ inputs, outputs, profile-config, pkgs, ... }: +{ + boot.loader = { + efi.canTouchEfiVariables = true; + grub = { + enable = true; + efiSupport = true; + device = "nodev"; + }; + }; +} diff --git a/hosts/vali/desktop/default.nix b/hosts/vali/desktop/default.nix new file mode 100644 index 0000000..32d04e5 --- /dev/null +++ b/hosts/vali/desktop/default.nix @@ -0,0 +1,16 @@ +{ inputs, outputs, pks, lib, profile-config, ... }: +{ + imports = [ + ../../../modules/vali/default.nix + ../common + ./hardware-configuration.nix + ./packages.nix + ./boot.nix + ]; + i3.enable = true; + security.polkit.enable = true; + # Set the keyboard layout to DE + services.xserver.xkb.layout.enable = "de"; + console.keyMap = "de"; +} + diff --git a/hosts/vali/desktop/hardware-configuration.nix b/hosts/vali/desktop/hardware-configuration.nix new file mode 100644 index 0000000..a8a4918 --- /dev/null +++ b/hosts/vali/desktop/hardware-configuration.nix @@ -0,0 +1,41 @@ +# 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 = [ "xhci_pci" "ahci" "nvme" "usb_storage" "usbhid" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/0423508a-6906-4872-baeb-2b1e6bd017a4"; + fsType = "ext4"; + }; + + boot.initrd.luks.devices."luks-c03fc486-bdd7-46bf-ac2f-1a55fe1abd6f".device = "/dev/disk/by-uuid/c03fc486-bdd7-46bf-ac2f-1a55fe1abd6f"; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/D299-5174"; + fsType = "vfat"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/bc68b3b5-1b58-4d8c-be8d-b06bbc4b6da7"; } + ]; + + # 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.enp4s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/vali/desktop/packages.nix b/hosts/vali/desktop/packages.nix new file mode 100644 index 0000000..4393be9 --- /dev/null +++ b/hosts/vali/desktop/packages.nix @@ -0,0 +1,26 @@ +{ inputs, outputs, pkgs, profile-config, ... }: + +{ + environment.systemPackages = with pkgs; [ + jetbrains.idea-community + ani-cli + okular + texliveFull + signal-desktop + nextcloud-client + vlc + strawberry + telegram-desktop + betterbird + vesktop + zsh + zoxide + eza + mpv + librewolf + keepassxc + feh + libreoffice + openjdk + ]; +} diff --git a/hosts/vali/laptop/default.nix b/hosts/vali/laptop/default.nix new file mode 100644 index 0000000..e69de29 diff --git a/hosts/vali/laptop/hardware-configuration.nix b/hosts/vali/laptop/hardware-configuration.nix new file mode 100644 index 0000000..e69de29 diff --git a/hosts/vali/laptop/packages.nix b/hosts/vali/laptop/packages.nix new file mode 100644 index 0000000..e69de29 diff --git a/modules/vali/core/boot/boot.nix b/modules/vali/core/boot/boot.nix new file mode 100644 index 0000000..13cdc34 --- /dev/null +++ b/modules/vali/core/boot/boot.nix @@ -0,0 +1,12 @@ +{ inputs, outputs, profile-config, pkgs, ... }: + +{ + boot.loader = { + efi.canTouchEfiVariables = true; + grub = { + enable = true; + efiSupport = true; + device = "nodev"; + }; + }; +} diff --git a/modules/vali/default.nix b/modules/vali/default.nix new file mode 100644 index 0000000..f93aa63 --- /dev/null +++ b/modules/vali/default.nix @@ -0,0 +1,9 @@ +{ pkgs, lib, config, ...}: +{ + imports = [ + ./core/boot/boot.nix + ./graphics/default.nix + #./web/default.nix + #./terminal/default.nix + ]; +} diff --git a/modules/vali/graphics/default.nix b/modules/vali/graphics/default.nix new file mode 100644 index 0000000..db0420d --- /dev/null +++ b/modules/vali/graphics/default.nix @@ -0,0 +1,6 @@ +{ pkgs, lib, config, ... }: +{ + import = [ + ./wms/i3wm.nix + ]; +} diff --git a/modules/vali/graphics/wms/i3wm.nix b/modules/vali/graphics/wms/i3wm.nix new file mode 100644 index 0000000..5a14ff4 --- /dev/null +++ b/modules/vali/graphics/wms/i3wm.nix @@ -0,0 +1,28 @@ +{ pkgs, lib, config, ...} +{ + options = { + i3.enable = lib.mkEnableOption "enable i3wm"; + }; + config = lib.mkIf config.i3wm.enable { + services.xserver = { + enable = true; + desktopManager = { + xterm.enable = false; + xfce = { + enable = true; + noDesktop = true; + nableXfwm = false; + }; + }; + displayManager.defaultSession="xfce+i3"; + windowManager.i3 = { + enable = true; + extraPackages = with pkgs; [ + dmenu + i3status + i3lock + ]; + }; + }; + } +} diff --git a/modules/vali/terminal/st.nix b/modules/vali/terminal/st.nix new file mode 100644 index 0000000..e69de29 diff --git a/modules/vali/terminal/starship.nix b/modules/vali/terminal/starship.nix new file mode 100644 index 0000000..e69de29 diff --git a/modules/vali/terminal/zsh.nix b/modules/vali/terminal/zsh.nix new file mode 100644 index 0000000..e69de29 diff --git a/modules/vali/web/schizofox.nix b/modules/vali/web/schizofox.nix new file mode 100644 index 0000000..e69de29