diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b511ae1 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.qcow2 diff --git a/README.md b/README.md new file mode 100644 index 0000000..907b290 --- /dev/null +++ b/README.md @@ -0,0 +1,33 @@ +# Getting Started Guide + +Steps you can follow after cloning this template: + +- Be sure to read the [den documentation](https://den.oeiuwq.com) + +- Update den input. + +```console +nix flake update den +``` + +- Edit [modules/hosts.nix](modules/hosts.nix) + +- Build + +```console +# default action is build +nix run .#igloo + +# pass any other nh action +nix run .#igloo -- switch +``` + +- Run the VM + +We recommend to use a VM develop cycle so you can play with the system before applying to your hardware. + +See [modules/vm.nix](modules/vm.nix) + +```console +nix run .#vm +``` diff --git a/flake.lock b/flake.lock index 7bd4c99..4a97fae 100644 --- a/flake.lock +++ b/flake.lock @@ -1,67 +1,47 @@ { "nodes": { - "aquamarine": { - "inputs": { - "hyprutils": [ - "hyprland", - "hyprutils" - ], - "hyprwayland-scanner": [ - "hyprland", - "hyprwayland-scanner" - ], - "nixpkgs": [ - "hyprland", - "nixpkgs" - ], - "systems": [ - "hyprland", - "systems" - ] - }, + "den": { "locked": { - "lastModified": 1776876344, - "narHash": "sha256-Ubqb/agkuMJK+k19gjQgHux/eOYRc1sRGoOZOho8+VY=", - "owner": "hyprwm", - "repo": "aquamarine", - "rev": "648a13d0ee1e03a843b3e145b8ece15393058701", + "lastModified": 1778511985, + "narHash": "sha256-jfpzuayHhYp5pLP3sETs/RP9XhZY5SahgX9aESm8+yc=", + "owner": "denful", + "repo": "den", + "rev": "12a1740bffdf7c9af36efbe9e3caed37c555f615", "type": "github" }, "original": { - "owner": "hyprwm", - "repo": "aquamarine", + "owner": "denful", + "repo": "den", "type": "github" } }, - "flake-compat": { - "flake": false, + "flake-file": { "locked": { - "lastModified": 1767039857, - "narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=", - "owner": "NixOS", - "repo": "flake-compat", - "rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab", + "lastModified": 1777679829, + "narHash": "sha256-zQxY90pq7BDbeimAiOfuK2U0huzo6oHOiC8zEpRgsbQ=", + "owner": "vic", + "repo": "flake-file", + "rev": "04ca28cf570276e70a9a5f694791ab2a60f1f300", "type": "github" }, "original": { - "owner": "NixOS", - "repo": "flake-compat", + "owner": "vic", + "repo": "flake-file", "type": "github" } }, "flake-parts": { "inputs": { "nixpkgs-lib": [ - "nixvim", "nixpkgs" ] }, "locked": { - "lastModified": 1777898446, - "narHash": "sha256-tTEOTTjMHd8Vffn4hehLTPgOXXxJ27xfkf4DoyZgD7s=", + "lastModified": 1777988971, + "narHash": "sha256-qIoWPDs+0/8JecyYgE3gpKQxW/4bLW/gp45vow9ioCQ=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "5d82aa3d6b5da25dbfec1a995750a70a03b8c659", + "rev": "0678d8986be1661af6bb555f3489f2fdfc31f6ff", "type": "github" }, "original": { @@ -70,28 +50,6 @@ "type": "github" } }, - "gitignore": { - "inputs": { - "nixpkgs": [ - "hyprland", - "pre-commit-hooks", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1709087332, - "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", - "owner": "hercules-ci", - "repo": "gitignore.nix", - "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "gitignore.nix", - "type": "github" - } - }, "home-manager": { "inputs": { "nixpkgs": [ @@ -99,11 +57,11 @@ ] }, "locked": { - "lastModified": 1777985523, - "narHash": "sha256-EpCQ/5AnnQABMeZpxXKt/Z+tUAI7k8c1DNR8/tWW8Do=", + "lastModified": 1778503501, + "narHash": "sha256-08L/X4/do7nET4rzidJ76eV/1r+mB7DchVpdPypsghc=", "owner": "nix-community", "repo": "home-manager", - "rev": "5a15505146ffd149dd88126562209028220c93e3", + "rev": "85ba629c79449badf4338117c27f0ee92b4b9f1a", "type": "github" }, "original": { @@ -112,486 +70,42 @@ "type": "github" } }, - "hyprcursor": { - "inputs": { - "hyprlang": [ - "hyprland", - "hyprlang" - ], - "nixpkgs": [ - "hyprland", - "nixpkgs" - ], - "systems": [ - "hyprland", - "systems" - ] - }, - "locked": { - "lastModified": 1776511930, - "narHash": "sha256-fCpwFiTW0rT7oKJqr3cqHMnkwypSwQKpbtUEtxdkgrM=", - "owner": "hyprwm", - "repo": "hyprcursor", - "rev": "39435900785d0c560c6ae8777d29f28617d031ef", - "type": "github" - }, - "original": { - "owner": "hyprwm", - "repo": "hyprcursor", - "type": "github" - } - }, - "hyprcursor-phinger": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1763845612, - "narHash": "sha256-78zH5GrYa35bEkzeVnl8uXFbZ/zsiSHayjxZlNt+Xe8=", - "owner": "jappie3", - "repo": "hyprcursor-phinger", - "rev": "1207a845501a28e0e00d4a8e935ee0c9cab30650", - "type": "github" - }, - "original": { - "owner": "jappie3", - "repo": "hyprcursor-phinger", - "type": "github" - } - }, - "hyprgraphics": { - "inputs": { - "hyprutils": [ - "hyprland", - "hyprutils" - ], - "nixpkgs": [ - "hyprland", - "nixpkgs" - ], - "systems": [ - "hyprland", - "systems" - ] - }, - "locked": { - "lastModified": 1776426399, - "narHash": "sha256-RUESLKNikIeEq9ymGJ6nmcDXiSFQpUW1IhJ245nL3xM=", - "owner": "hyprwm", - "repo": "hyprgraphics", - "rev": "68d064434787cf1ed4a2fe257c03c5f52f33cf84", - "type": "github" - }, - "original": { - "owner": "hyprwm", - "repo": "hyprgraphics", - "type": "github" - } - }, - "hyprland": { - "inputs": { - "aquamarine": "aquamarine", - "hyprcursor": "hyprcursor", - "hyprgraphics": "hyprgraphics", - "hyprland-guiutils": "hyprland-guiutils", - "hyprland-protocols": "hyprland-protocols", - "hyprlang": "hyprlang", - "hyprutils": "hyprutils", - "hyprwayland-scanner": "hyprwayland-scanner", - "hyprwire": "hyprwire", - "nixpkgs": [ - "nixpkgs" - ], - "pre-commit-hooks": "pre-commit-hooks", - "systems": "systems", - "xdph": "xdph" - }, - "locked": { - "lastModified": 1777910456, - "narHash": "sha256-YXQ5bhn5mklMsOuVqze3QBqqL+8zsUum24Yx1K2Rb+w=", - "owner": "hyprwm", - "repo": "Hyprland", - "rev": "eff3bfe261e90b8950b59379ca7815f735a7aab6", - "type": "github" - }, - "original": { - "owner": "hyprwm", - "repo": "Hyprland", - "type": "github" - } - }, - "hyprland-guiutils": { - "inputs": { - "aquamarine": [ - "hyprland", - "aquamarine" - ], - "hyprgraphics": [ - "hyprland", - "hyprgraphics" - ], - "hyprlang": [ - "hyprland", - "hyprlang" - ], - "hyprtoolkit": "hyprtoolkit", - "hyprutils": [ - "hyprland", - "hyprutils" - ], - "hyprwayland-scanner": [ - "hyprland", - "hyprwayland-scanner" - ], - "nixpkgs": [ - "hyprland", - "nixpkgs" - ], - "systems": [ - "hyprland", - "systems" - ] - }, - "locked": { - "lastModified": 1776426575, - "narHash": "sha256-KI6nIfVihn/DPaeB5Et46Xg3dkNHrrEtUd5LBBVomB0=", - "owner": "hyprwm", - "repo": "hyprland-guiutils", - "rev": "a968d211048e3ed538e47b84cb3649299578f19d", - "type": "github" - }, - "original": { - "owner": "hyprwm", - "repo": "hyprland-guiutils", - "type": "github" - } - }, - "hyprland-protocols": { - "inputs": { - "nixpkgs": [ - "hyprland", - "nixpkgs" - ], - "systems": [ - "hyprland", - "systems" - ] - }, - "locked": { - "lastModified": 1772460177, - "narHash": "sha256-/6G/MsPvtn7bc4Y32pserBT/Z4SUUdBd4XYJpOEKVR4=", - "owner": "hyprwm", - "repo": "hyprland-protocols", - "rev": "1cb6db5fd6bb8aee419f4457402fa18293ace917", - "type": "github" - }, - "original": { - "owner": "hyprwm", - "repo": "hyprland-protocols", - "type": "github" - } - }, - "hyprlang": { - "inputs": { - "hyprutils": [ - "hyprland", - "hyprutils" - ], - "nixpkgs": [ - "hyprland", - "nixpkgs" - ], - "systems": [ - "hyprland", - "systems" - ] - }, - "locked": { - "lastModified": 1776426736, - "narHash": "sha256-rl7i4aY+9p8LysJp7o8uRWahCkpFznCgGHXszlTw7b0=", - "owner": "hyprwm", - "repo": "hyprlang", - "rev": "7833ff33b2e82d3406337b5dcf0d1cec595d83e9", - "type": "github" - }, - "original": { - "owner": "hyprwm", - "repo": "hyprlang", - "type": "github" - } - }, - "hyprtoolkit": { - "inputs": { - "aquamarine": [ - "hyprland", - "hyprland-guiutils", - "aquamarine" - ], - "hyprgraphics": [ - "hyprland", - "hyprland-guiutils", - "hyprgraphics" - ], - "hyprlang": [ - "hyprland", - "hyprland-guiutils", - "hyprlang" - ], - "hyprutils": [ - "hyprland", - "hyprland-guiutils", - "hyprutils" - ], - "hyprwayland-scanner": [ - "hyprland", - "hyprland-guiutils", - "hyprwayland-scanner" - ], - "nixpkgs": [ - "hyprland", - "hyprland-guiutils", - "nixpkgs" - ], - "systems": [ - "hyprland", - "hyprland-guiutils", - "systems" - ] - }, - "locked": { - "lastModified": 1772462885, - "narHash": "sha256-5pHXrQK9zasMnIo6yME6EOXmWGFMSnCITcfKshhKJ9I=", - "owner": "hyprwm", - "repo": "hyprtoolkit", - "rev": "9af245a69fa6b286b88ddfc340afd288e00a6998", - "type": "github" - }, - "original": { - "owner": "hyprwm", - "repo": "hyprtoolkit", - "type": "github" - } - }, - "hyprutils": { - "inputs": { - "nixpkgs": [ - "hyprland", - "nixpkgs" - ], - "systems": [ - "hyprland", - "systems" - ] - }, - "locked": { - "lastModified": 1777492286, - "narHash": "sha256-PwuoEJQcjSKJNP5T55qhfDwIP0tw5zxEhfu8GDfKfeg=", - "owner": "hyprwm", - "repo": "hyprutils", - "rev": "ec5c0c709706bad5b82f667fd8758eae442577ce", - "type": "github" - }, - "original": { - "owner": "hyprwm", - "repo": "hyprutils", - "type": "github" - } - }, - "hyprwayland-scanner": { - "inputs": { - "nixpkgs": [ - "hyprland", - "nixpkgs" - ], - "systems": [ - "hyprland", - "systems" - ] - }, + "import-tree": { "locked": { - "lastModified": 1777148232, - "narHash": "sha256-Uv0WZLhu89SafuSOmYDA7akrPt4wBRmsa1ucasO5aXg=", - "owner": "hyprwm", - "repo": "hyprwayland-scanner", - "rev": "fec9cf1abcc1011e46f0a0986f46bf93c6bf8b92", + "lastModified": 1773693634, + "narHash": "sha256-BtZ2dtkBdSUnFPPFc+n0kcMbgaTxzFNPv2iaO326Ffg=", + "owner": "vic", + "repo": "import-tree", + "rev": "c41e7d58045f9057880b0d85e1152d6a4430dbf1", "type": "github" }, "original": { - "owner": "hyprwm", - "repo": "hyprwayland-scanner", - "type": "github" - } - }, - "hyprwire": { - "inputs": { - "hyprutils": [ - "hyprland", - "hyprutils" - ], - "nixpkgs": [ - "hyprland", - "nixpkgs" - ], - "systems": [ - "hyprland", - "systems" - ] - }, - "locked": { - "lastModified": 1776728575, - "narHash": "sha256-z9eGphrArEBpl1O/GCH0wlY6z4K9vA6yWh2gAS6qytU=", - "owner": "hyprwm", - "repo": "hyprwire", - "rev": "f3a80888783702a39691b684d099e16b83ed4702", - "type": "github" - }, - "original": { - "owner": "hyprwm", - "repo": "hyprwire", + "owner": "vic", + "repo": "import-tree", "type": "github" } }, "nixpkgs": { "locked": { - "lastModified": 1777578337, - "narHash": "sha256-Ad49moKWeXtKBJNy2ebiTQUEgdLyvGmTeykAQ9xM+Z4=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "15f4ee454b1dce334612fa6843b3e05cf546efab", - "type": "github" + "lastModified": 1778458615, + "narHash": "sha256-UuHF8sb6WETWb7HPfOvOVXTAl7UX0VAoxM0Our8WFK0=", + "rev": "c6e5ca3c836a5f4dd9af9f2c1fc1c38f0fac988a", + "type": "tarball", + "url": "https://releases.nixos.org/nixpkgs/nixpkgs-26.05pre995785.c6e5ca3c836a/nixexprs.tar.xz" }, "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixvim": { - "inputs": { - "flake-parts": "flake-parts", - "nixpkgs": [ - "nixpkgs" - ], - "systems": "systems_2" - }, - "locked": { - "lastModified": 1777917888, - "narHash": "sha256-uniQZkmzp+mQm6/7DZVzG0HGunF3gU4r0yKg3KG0sZo=", - "owner": "nix-community", - "repo": "nixvim", - "rev": "17922b6be51e335563609ba6c74656a839285e01", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "nixvim", - "type": "github" - } - }, - "pre-commit-hooks": { - "inputs": { - "flake-compat": "flake-compat", - "gitignore": "gitignore", - "nixpkgs": [ - "hyprland", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1776796298, - "narHash": "sha256-PcRvlWayisPSjd0UcRQbhG8Oqw78AcPE6x872cPRHN8=", - "owner": "cachix", - "repo": "git-hooks.nix", - "rev": "3cfd774b0a530725a077e17354fbdb87ea1c4aad", - "type": "github" - }, - "original": { - "owner": "cachix", - "repo": "git-hooks.nix", - "type": "github" + "type": "tarball", + "url": "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz" } }, "root": { "inputs": { + "den": "den", + "flake-file": "flake-file", + "flake-parts": "flake-parts", "home-manager": "home-manager", - "hyprcursor-phinger": "hyprcursor-phinger", - "hyprland": "hyprland", - "nixpkgs": "nixpkgs", - "nixvim": "nixvim" - } - }, - "systems": { - "locked": { - "lastModified": 1689347949, - "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", - "owner": "nix-systems", - "repo": "default-linux", - "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default-linux", - "type": "github" - } - }, - "systems_2": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "xdph": { - "inputs": { - "hyprland-protocols": [ - "hyprland", - "hyprland-protocols" - ], - "hyprlang": [ - "hyprland", - "hyprlang" - ], - "hyprutils": [ - "hyprland", - "hyprutils" - ], - "hyprwayland-scanner": [ - "hyprland", - "hyprwayland-scanner" - ], - "nixpkgs": [ - "hyprland", - "nixpkgs" - ], - "systems": [ - "hyprland", - "systems" - ] - }, - "locked": { - "lastModified": 1777035886, - "narHash": "sha256-m1TNuBoSXUBSKhD9UVMkU90M0wFTPTfvIOOltO8IM8A=", - "owner": "hyprwm", - "repo": "xdg-desktop-portal-hyprland", - "rev": "ecfcdcc781f48821d83e1e2a0e30d7beca0eeb5e", - "type": "github" - }, - "original": { - "owner": "hyprwm", - "repo": "xdg-desktop-portal-hyprland", - "type": "github" + "import-tree": "import-tree", + "nixpkgs": "nixpkgs" } } }, diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..66592b3 --- /dev/null +++ b/flake.nix @@ -0,0 +1,20 @@ +# DO-NOT-EDIT. This file was auto-generated using github:vic/flake-file. +# Use `nix run .#write-flake` to regenerate it. +{ + outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } (inputs.import-tree ./modules); + + inputs = { + den.url = "github:denful/den"; + flake-file.url = "github:vic/flake-file"; + 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"; + }; + import-tree.url = "github:vic/import-tree"; + nixpkgs.url = "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz"; + }; +} diff --git a/modules/defaults.nix b/modules/defaults.nix new file mode 100644 index 0000000..ed70a6a --- /dev/null +++ b/modules/defaults.nix @@ -0,0 +1,15 @@ +{ lib, den, ... }: +{ + den.default.nixos.system.stateVersion = "25.11"; + den.default.homeManager.home.stateVersion = "25.11"; + + # enable hm by default + den.schema.user.classes = lib.mkDefault [ "homeManager" ]; + + # User TODO: REMOVE THIS + den.aspects.tux.nixos = { + boot.loader.grub.enable = false; + fileSystems."/".device = "/dev/fake"; + fileSystems."/".fsType = "auto"; + }; +} diff --git a/modules/dendritic.nix b/modules/dendritic.nix new file mode 100644 index 0000000..415b185 --- /dev/null +++ b/modules/dendritic.nix @@ -0,0 +1,17 @@ +{ inputs, ... }: +{ + imports = [ + (inputs.flake-file.flakeModules.dendritic or { }) + (inputs.den.flakeModules.dendritic or { }) + ]; + + # other inputs may be defined at a module using them. + flake-file.inputs = { + den.url = "github:denful/den"; + flake-file.url = "github:vic/flake-file"; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; +} diff --git a/modules/hosts.nix b/modules/hosts.nix new file mode 100644 index 0000000..a4f89ee --- /dev/null +++ b/modules/hosts.nix @@ -0,0 +1,19 @@ +# defines all hosts + users + homes. +# then config their aspects in as many files you want +{ + # tux user at igloo host. + den.hosts.x86_64-linux.igloo.users.tux = { }; + + # define an standalone home-manager for tux + # den.homes.x86_64-linux.tux = { }; + + # be sure to add nix-darwin input for this: + # den.hosts.aarch64-darwin.apple.users.alice = { }; + + # other hosts can also have user tux. + # den.hosts.x86_64-linux.south = { + # wsl = { }; # add nixos-wsl input for this. + # users.tux = { }; + # users.orca = { }; + # }; +} diff --git a/modules/igloo.nix b/modules/igloo.nix new file mode 100644 index 0000000..9d5dd08 --- /dev/null +++ b/modules/igloo.nix @@ -0,0 +1,18 @@ +{ + # host aspect + den.aspects.igloo = { + # host NixOS configuration + nixos = + { pkgs, ... }: + { + environment.systemPackages = [ pkgs.hello ]; + }; + + # host provides default home environment for its users + provides.to-users.homeManager = + { pkgs, ... }: + { + home.packages = [ pkgs.vim ]; + }; + }; +} diff --git a/modules/nh.nix b/modules/nh.nix new file mode 100644 index 0000000..3079b01 --- /dev/null +++ b/modules/nh.nix @@ -0,0 +1,9 @@ +# Exposes flake apps under the name of each host / home for building with nh. +{ den, lib, ... }: +{ + perSystem = + { pkgs, ... }: + { + packages = den.lib.nh.denPackages { fromFlake = true; } pkgs; + }; +} diff --git a/modules/tux.nix b/modules/tux.nix new file mode 100644 index 0000000..015a1f3 --- /dev/null +++ b/modules/tux.nix @@ -0,0 +1,21 @@ +{ den, ... }: +{ + # user aspect + den.aspects.tux = { + includes = [ + den.batteries.define-user + den.batteries.primary-user + (den.batteries.user-shell "fish") + ]; + + homeManager = + { pkgs, ... }: + { + home.packages = [ pkgs.htop ]; + }; + + # user can provide NixOS configurations + # to any host it is included on + provides.to-hosts.nixos = { pkgs, ... }: { }; + }; +} diff --git a/modules/vm.nix b/modules/vm.nix new file mode 100644 index 0000000..a330064 --- /dev/null +++ b/modules/vm.nix @@ -0,0 +1,24 @@ +# enables `nix run .#vm`. it is very useful to have a VM +# you can edit your config and launch the VM to test stuff +# instead of having to reboot each time. +{ inputs, den, ... }: +{ + + # USER TODO: remove this tty-autologin used for the VM + den.aspects.igloo.includes = [ (den.batteries.tty-autologin "tux") ]; + + perSystem = + { pkgs, ... }: + { + packages.vm = pkgs.writeShellApplication { + name = "vm"; + text = + let + host = inputs.self.nixosConfigurations.igloo.config; + in + '' + ${host.system.build.vm}/bin/run-${host.networking.hostName}-vm "$@" + ''; + }; + }; +}