Recently Written · git

nixtoo-genux

Declarative Nix package manager setup. A new linux distro.

git clone https://github.com/equwal/nixtoo-genux

Log | Files | Refs


commit a27a8ea29b2b66b5bd422259264c20e7c1cc2dd2
Spenser Truex <truex@equwal.com>
2025-09-04 15:51:51 -0700

Gentoo nixcux!

 INSTALL.sh            |  5 +++++
 README.md             | 19 +++++++++++++++++++
 aliasrc-additions.zsh |  8 ++++++++
 flake.nix             | 41 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 73 insertions(+)
diff --git a/INSTALL.sh b/INSTALL.sh
new file mode 100755
index 0000000..c9391f7
--- /dev/null
+++ b/INSTALL.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+sudo cp flake.nix /nix/var/nix/profiles/per-user/root/flake.nix
+sudo nix run /nix/var/nix/profiles/per-user/root#profile.switch
+cat aliasrc-additions.zsh >> ~/.config/zsh/aliasrc
+source ~/.config/zsh/aliasrc
\ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..3f02496
--- /dev/null
+++ b/README.md
@@ -0,0 +1,19 @@
+# Nix package manager on another OS (no nix-env). 100% Declarative setup.
+
+Including Gentoo of course. Nixtoo Genux!
+
+## Files:
+
+1. `flake.nix`: Put packages here. Includes a dev shell and flakey.
+2. `aliasrc-additions.zsh`:  Aliases to make it easier to use the setup. Very mandatory.
+3. `INSTALL.sh`: Installs this setup. Install it after installing
+the multi-user installation of nix from the [official website using curl into shell](https://nixos.org/download/) or
+(for Gentoo) from`sys-apps/nix` from [Trofi's nix-guix-gentoo
+overlay](https://github.com/trofi/nix-guix-gentoo)
+
+## Aliases:
+`nix-install <package>`: Add a package to the file (uses sed) and rebuild.
+`nix-uninstall <package>`: Remove a package from the file (uses sed) and rebuild.
+`nix-update`: Update and rebuild the system.
+`nix-rebuild`: Rebuild the system but don't update.
+`nix-develop`: Makes a nix dev shell for the system. Redundant when using flakey (default).
diff --git a/aliasrc-additions.zsh b/aliasrc-additions.zsh
new file mode 100644
index 0000000..a30784c
--- /dev/null
+++ b/aliasrc-additions.zsh
@@ -0,0 +1,8 @@
+# nix rebuild alias
+alias nix-rebuild='sudo nix run /path/to/your/flake#profile.switch'
+
+# nix package management one-liners
+alias nix-install='f(){ sudo sed -i "/# zzz automatically added by alias/i\\        $1" /path/to/your/flake.nix && sudo nix run /path/to/your/flake#profile.switch; }; f'
+alias nix-uninstall='f(){ sudo sed -i "/^\s*$1$/d" /path/to/your/flake.nix && sudo nix run /path/to/your/flake#profile.switch; }; f'
+alias nix-update='f(){ cd /path/to/your/flake && sudo nix flake update && sudo nix run .#profile.switch; }; f'
+alias nix-develop='nix develop /path/to/your/flake'
\ No newline at end of file
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..0ae765a
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,41 @@
+{
+  description = "Flake setup";
+
+  inputs = {
+    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
+    flakey-profile.url = "github:lf-/flakey-profile";
+  };
+
+  outputs = { self, nixpkgs, flakey-profile, ... }: 
+    let
+      system = "x86_64-linux";
+      pkgs = import nixpkgs {
+        inherit system;
+        config.allowUnfree = true;
+      };
+      
+      packageList = with pkgs; [
+        # Add your packages here - one per line
+        hello
+        firefox
+        git
+        # zzz automatically added by alias
+      ];
+    in {
+      packages.${system} = {
+        default = pkgs.symlinkJoin {
+          name = "my-packages";
+          paths = packageList;
+        };
+        
+        profile = flakey-profile.lib.mkProfile {
+          inherit pkgs;
+          paths = packageList;
+        };
+      };
+      
+      devShells.${system}.default = pkgs.mkShell {
+        buildInputs = packageList;
+      };
+    };
+}
\ No newline at end of file