diff --git a/README.md b/README.md index d852264..ba91ecc 100644 --- a/README.md +++ b/README.md @@ -33,3 +33,24 @@ The main goals of this rewritten flake are: - improved secrets management - keeping external assets closer to their related nix file, e.g. wallpapers in the desktop modules folder + +## 🏗️ Structure +The structure this flake aims to build on is relatively simple to grasp. + +``` +flake.nix --> The flake. +/systems --> NixOS configurations for various types of systems, using easy-hosts. +/modules --> Modules that are mapped to their corresponding easy-hosts class (and home modules). + /nixos --> (example) Modules specific to the nixos class configured in easy-hosts. +/homes --> Directory for home-manager configurations, not specific to the system type. +/lib --> A place for custom lib attributes exposed on the flake namespace (lib.puzzlevision.mkOpt). +(more...) --> Additional directories have been considered (e.g. shells), but as of right now, they serve no use to me. +``` + +## 🎨 Credits +Parts of this flake were inspired by the likes of: + +- [isabelroses](https://github.com/isabelroses) +- [uncenter](https://github.com/uncenter) + +Many thanks to their hard work! diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..bc4a1f4 --- /dev/null +++ b/flake.lock @@ -0,0 +1,85 @@ +{ + "nodes": { + "easy-hosts": { + "locked": { + "lastModified": 1736680851, + "narHash": "sha256-KUkO4H0W+1u5piwAzIzCuVhamQ0L3io8vR61NrODtHs=", + "owner": "isabelroses", + "repo": "easy-hosts", + "rev": "450d2ae463bb8fb55194f33073ebdd83b8b7ddaa", + "type": "github" + }, + "original": { + "owner": "isabelroses", + "repo": "easy-hosts", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1736143030, + "narHash": "sha256-+hu54pAoLDEZT9pjHlqL9DNzWz0NbUn8NEAHP7PQPzU=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "b905f6fc23a9051a6e1b741e1438dbfc0634c6de", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1736785676, + "narHash": "sha256-TY0jUwR3EW0fnS0X5wXMAVy6h4Z7Y6a3m+Yq++C9AyE=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "fc52a210b60f2f52c74eac41a8647c1573d2071d", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1736701207, + "narHash": "sha256-jG/+MvjVY7SlTakzZ2fJ5dC3V1PrKKrUEOEE30jrOKA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ed4a395ea001367c1f13d34b1e01aa10290f67d6", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "easy-hosts": "easy-hosts", + "flake-parts": "flake-parts", + "home-manager": "home-manager", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..20f1294 --- /dev/null +++ b/flake.nix @@ -0,0 +1,31 @@ +{ + description = "Jo's dotfiles"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + + # Flake parts, a library that provides utilites for creating flakes + flake-parts = { + url = "github:hercules-ci/flake-parts"; + inputs.nixpkgs-lib.follows = "nixpkgs"; + }; + + # Provides an easy interface for loading systems from a directory + easy-hosts.url = "github:isabelroses/easy-hosts"; + + # + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = inputs@{ flake-parts, ... }: + flake-parts.lib.mkFlake { inherit inputs; } { + imports = [ + ./systems + ]; + + systems = [ "x86_64-linux" ]; + }; +} diff --git a/homes/default.nix b/homes/default.nix new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/homes/default.nix @@ -0,0 +1 @@ +{} diff --git a/homes/jo/default.nix b/homes/jo/default.nix new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/homes/jo/default.nix @@ -0,0 +1 @@ +{} diff --git a/modules/home/default.nix b/modules/home/default.nix new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/modules/home/default.nix @@ -0,0 +1 @@ +{} diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/modules/nixos/default.nix @@ -0,0 +1 @@ +{} diff --git a/systems/default.nix b/systems/default.nix new file mode 100644 index 0000000..ca0838f --- /dev/null +++ b/systems/default.nix @@ -0,0 +1,30 @@ +{ + lib, + self, + inputs, + ... +}: +{ + imports = [ inputs.easy-hosts.flakeModule ]; + + easyHosts = { + autoConstruct = true; + path = ../systems; + + shared.modules = [ + ../homes + ]; + + perClass = + class: + { + modules = [ + "${self}/modules/${class}" + + (lib.optionals (class == "nixos") [ + inputs.home-manager.nixosModules.home-manager + ]) + ]; + }; + }; +} diff --git a/systems/x86_64-nixos/puzzlevision/default.nix b/systems/x86_64-nixos/puzzlevision/default.nix new file mode 100644 index 0000000..e7653fb --- /dev/null +++ b/systems/x86_64-nixos/puzzlevision/default.nix @@ -0,0 +1,27 @@ +{ + pkgs, + ... +}: +{ + imports = [ + ./hardware.nix + ]; + + # Enable Plasma6 + services.xserver.enable = true; + services.displayManager.sddm.wayland.enable = true; + services.desktopManager.plasma6.enable = true; + + # Todo: pass a set of users to enable from within easy-hosts and automatically map the corresponding home-manager configurations + # Register "jo" as a user + users.users.jo.isNormalUser = true; + users.users.jo.extraGroups = [ "dialout" "docker" ]; + users.users.jo.initialPassword = "balls"; + users.users.jo.createHome = true; + + environment.systemPackages = with pkgs; [ + ghostty + ]; + + system.stateVersion = "25.05"; +} diff --git a/systems/x86_64-nixos/puzzlevision/hardware.nix b/systems/x86_64-nixos/puzzlevision/hardware.nix new file mode 100644 index 0000000..5cc295c --- /dev/null +++ b/systems/x86_64-nixos/puzzlevision/hardware.nix @@ -0,0 +1,52 @@ +# 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" "vmd" "nvme" "usbhid" "rtsx_pci_sdmmc" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/864b1287-89fd-4cc0-98a5-40a3caf804c6"; + fsType = "btrfs"; + options = [ "subvol=@" ]; + }; + + boot.initrd.luks.devices."luks-5fd4fc76-d5c5-46c3-b952-1a7a7ff3a1fc".device = "/dev/disk/by-uuid/5fd4fc76-d5c5-46c3-b952-1a7a7ff3a1fc"; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/2429-4141"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + + 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.br-01571e4eda2f.useDHCP = lib.mkDefault true; + # networking.interfaces.br-20785fae249b.useDHCP = lib.mkDefault true; + # networking.interfaces.br-64a49a5722c1.useDHCP = lib.mkDefault true; + # networking.interfaces.br-71e5fc5962fc.useDHCP = lib.mkDefault true; + # networking.interfaces.br-7df9905783da.useDHCP = lib.mkDefault true; + # networking.interfaces.br-9b746f4e7e2f.useDHCP = lib.mkDefault true; + # networking.interfaces.br-e2f470a56dfe.useDHCP = lib.mkDefault true; + # networking.interfaces.docker0.useDHCP = lib.mkDefault true; + # networking.interfaces.enp0s13f0u4u4.useDHCP = lib.mkDefault true; + # networking.interfaces.veth4e96b46.useDHCP = lib.mkDefault true; + # networking.interfaces.veth96a5ccd.useDHCP = lib.mkDefault true; + # networking.interfaces.wlo1.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkForce "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +}