diff --git a/nix/flake.lock b/nix/flake.lock index 0b74a57..a2a550a 100644 --- a/nix/flake.lock +++ b/nix/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1720469887, - "narHash": "sha256-BwPsGQ/EMqCreUc5j9Efj+wx13AjREtuHhbyHZygcE4=", + "lastModified": 1704277720, + "narHash": "sha256-meAKNgmh3goankLGWqqpw73pm9IvXjEENJloF0coskE=", "owner": "lnl7", "repo": "nix-darwin", - "rev": "fabc653517106127e2ed435fb52e7e8854354428", + "rev": "0dd382b70c351f528561f71a0a7df82c9d2be9a4", "type": "github" }, "original": { @@ -23,52 +23,19 @@ "dotfiles": { "flake": false, "locked": { - "lastModified": 1717202661, - "narHash": "sha256-yRqcINrAjRhW7JGE2qoAvQv1hirZLGZwmxayAMdtCU0=", + "lastModified": 1702297498, + "narHash": "sha256-wBeX8mOuPwXzHmPSTwcafa3ioV1r1biBaM4Pz9TQezw=", "ref": "refs/heads/master", - "rev": "66b760491c829609e016688beaa121d3aa1d2188", - "revCount": 473, + "rev": "be29a97b84dbb54e125dac19df3478464b7f76ca", + "revCount": 456, "submodules": true, "type": "git", - "url": "https://github.com/lexisother/dotfiles" + "url": "https://github.com/keanuplayz/dotfiles" }, "original": { "submodules": true, "type": "git", - "url": "https://github.com/lexisother/dotfiles" - } - }, - "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flakey-profile": { - "locked": { - "lastModified": 1712898590, - "narHash": "sha256-FhGIEU93VHAChKEXx905TSiPZKga69bWl1VB37FK//I=", - "owner": "lf-", - "repo": "flakey-profile", - "rev": "243c903fd8eadc0f63d205665a92d4df91d42d9d", - "type": "github" - }, - "original": { - "owner": "lf-", - "repo": "flakey-profile", - "type": "github" + "url": "https://github.com/keanuplayz/dotfiles" } }, "home-manager": { @@ -78,69 +45,32 @@ ] }, "locked": { - "lastModified": 1720042825, - "narHash": "sha256-A0vrUB6x82/jvf17qPCpxaM+ulJnD8YZwH9Ci0BsAzE=", + "lastModified": 1702195668, + "narHash": "sha256-Lxmjez0nfNBptdqV5GsXKm7Bb7swjGsrxiLxWJu0tL8=", "owner": "nix-community", "repo": "home-manager", - "rev": "e1391fb22e18a36f57e6999c7a9f966dc80ac073", + "rev": "33110fb3c7fe6a94b98b641866a5eddb64b7c23f", "type": "github" }, "original": { "owner": "nix-community", - "ref": "release-24.05", + "ref": "release-23.05", "repo": "home-manager", "type": "github" } }, - "lix": { - "inputs": { - "flake-utils": "flake-utils", - "flakey-profile": "flakey-profile", - "lix": "lix_2", - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1719353937, - "narHash": "sha256-86NBqDxAP20ET/UoKX0WvSItblNQ97czXb2q7lkMrwk=", - "ref": "refs/heads/main", - "rev": "5d9d94089fb1ca96222a34bfe245ef5c5ebefd37", - "revCount": 92, - "type": "git", - "url": "https://git.lix.systems/lix-project/nixos-module" - }, - "original": { - "type": "git", - "url": "https://git.lix.systems/lix-project/nixos-module" - } - }, - "lix_2": { - "flake": false, - "locked": { - "lastModified": 1718767907, - "narHash": "sha256-gpd+mGQxqVHw2kO6rSPQel8TkChHh9UpqxjsmQi0QJM=", - "rev": "85f282ef572577899b3d80ba8def1b920a386218", - "type": "tarball", - "url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/85f282ef572577899b3d80ba8def1b920a386218.tar.gz" - }, - "original": { - "type": "tarball", - "url": "https://git.lix.systems/lix-project/lix/archive/main.tar.gz" - } - }, "nixpkgs": { "locked": { - "lastModified": 1720492477, - "narHash": "sha256-PV6LKJpj43tuKAMEfmXiKZjlOW1IqZORUJ8WYcdLtGE=", + "lastModified": 1705033721, + "narHash": "sha256-K5eJHmL1/kev6WuqyqqbS1cdNnSidIZ3jeqJ7GbrYnQ=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "64f145f456b7a3953f191cad9e257cd88412044e", + "rev": "a1982c92d8980a0114372973cbdfe0a307f1bdea", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixpkgs-24.05-darwin", + "ref": "nixpkgs-23.05-darwin", "repo": "nixpkgs", "type": "github" } @@ -150,24 +80,8 @@ "darwin": "darwin", "dotfiles": "dotfiles", "home-manager": "home-manager", - "lix": "lix", "nixpkgs": "nixpkgs" } - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } } }, "root": "root", diff --git a/nix/flake.nix b/nix/flake.nix index cf246b6..504122d 100644 --- a/nix/flake.nix +++ b/nix/flake.nix @@ -2,54 +2,28 @@ description = "flake of the lyxer..."; inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-24.05-darwin"; - home-manager.url = "github:nix-community/home-manager/release-24.05"; + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-23.05-darwin"; + home-manager.url = "github:nix-community/home-manager/release-23.05"; + home-manager.inputs.nixpkgs.follows = "nixpkgs"; + # nix will normally use the nixpkgs defined in home-managers inputs, we only want one copy of nixpkgs though darwin.url = "github:lnl7/nix-darwin"; - lix.url = "git+https://git.lix.systems/lix-project/nixos-module"; + darwin.inputs.nixpkgs.follows = "nixpkgs"; # ... dotfiles = { - url = "https://github.com/lexisother/dotfiles"; + url = "https://github.com/keanuplayz/dotfiles"; type = "git"; submodules = true; flake = false; }; - - home-manager.inputs.nixpkgs.follows = "nixpkgs"; - darwin.inputs.nixpkgs.follows = "nixpkgs"; - lix.inputs.nixpkgs.follows = "nixpkgs"; }; # add the inputs declared above to the argument attribute set - outputs = { self, nixpkgs, lix, home-manager, dotfiles, darwin }: let - system = "x86_64-darwin"; - importAll = path: map - (p: import (path + ("/" + p))) - (builtins.attrNames (builtins.readDir path)); - pkgs = import nixpkgs { - inherit system; - overlays = importAll ./overlays; - }; - libs = with builtins; listToAttrs (map - (path: { - name = replaceStrings [".nix"] [""] path; - value = (import (pkgs.lib.path.append ./lib path)) { inherit pkgs; }; - }) - (attrNames (readDir ./lib))); - in { + outputs = { self, nixpkgs, home-manager, dotfiles, darwin }: { darwinConfigurations."alymac" = darwin.lib.darwinSystem { - inherit system; - specialArgs = libs; + system = "x86_64-darwin"; + specialArgs = { inherit self; inherit dotfiles; }; modules = [ - ./system - lix.nixosModules.default home-manager.darwinModules.home-manager - { - home-manager = { - extraSpecialArgs = { inherit self; inherit dotfiles; } // libs; - useGlobalPkgs = true; - useUserPackages = true; - users.alyxia.imports = [ ./home ]; - }; - } + ./hosts/alymac/default.nix ]; }; }; diff --git a/nix/home/default.nix b/nix/home/default.nix deleted file mode 100644 index 14146e1..0000000 --- a/nix/home/default.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ importAll, ... }: - -{ - imports = importAll [] ./.; - - home.stateVersion = "24.05"; -} diff --git a/nix/home/packages.nix b/nix/home/packages.nix deleted file mode 100644 index 8b7065a..0000000 --- a/nix/home/packages.nix +++ /dev/null @@ -1,93 +0,0 @@ -{ pkgs, ... }: - -let - packageSets = with pkgs; { - system = [ - gnutls - gsasl - libtool - patchelf - pcre - pkg-config - ]; - - base = [ - act - bat - bitwarden-cli - cloudflared - delta - eza - ffmpeg - fzf - gh - git-crypt - gitui - gnupg - jq - kubectl - kubelogin-oidc - mosh - nixpkgs-fmt - pandoc - ripgrep - sops - stylua - texlive.combined.scheme-small - typst - vim - wget - - # Fyra - glib-networking - meson - ninja - vala - desktop-file-utils - ]; - - languages = [ - crystal - dhall - dhall-json - dhall-lsp-server - go - jdk - kotlin - kotlin-language-server - lua-language-server - nil - nodejs_20 - python2 - ruby_3_1 - sbcl - shards - zig - ]; - - programs = [ - rectangle - tailscale - ]; - - multimedia = [ - ffmpeg - ]; - - fonts = [ - nerdfonts - ibm-plex - ]; - - python = with python311Packages; [ - colorama - psutil - distro - ]; - }; - everything = builtins.concatLists (builtins.attrValues packageSets); - -in -{ - home.packages = everything; -} diff --git a/nix/hosts/alymac/default.nix b/nix/hosts/alymac/default.nix new file mode 100644 index 0000000..4543cfd --- /dev/null +++ b/nix/hosts/alymac/default.nix @@ -0,0 +1,286 @@ +{ self, pkgs, lib, dotfiles, ... }: + +with lib; +let + textEditor = "nvim"; + + packageSets = with pkgs; rec { + system = [ + gnutls + gsasl + libtool + patchelf + pcre + pkg-config + ]; + + base = [ + act + bat + bitwarden-cli + cloudflared + delta + exa + ffmpeg + fzf + gh + git-crypt + gitui + gnupg + jq + kubectl + kubelogin-oidc + mosh + nixpkgs-fmt + pandoc + ripgrep + sops + stylua + texlive.combined.scheme-small + typst + vim + wget + + # Fyra + glib-networking + meson + ninja + vala + desktop-file-utils + ]; + + languages = [ + crystal + dhall + dhall-json + dhall-lsp-server + go + jdk + kotlin + kotlin-language-server + lua-language-server + nil + nodejs_20 + python2 + ruby_3_1 + sbcl + shards + zig + ]; + + programs = [ + rectangle + tailscale + ]; + + multimedia = [ + ffmpeg + ]; + + fonts = [ + nerdfonts + ibm-plex + ]; + + python = with python311Packages; [ + colorama + psutil + distro + ]; + + everything = system ++ base ++ languages ++ programs ++ multimedia ++ fonts ++ python; + }; + + # Old solution kept for posterity {{{ + # We've got a small issue here. I tested this in a repl, and what I've + # observed is that listFilesRecursive spits out [ /full/path/to/default.nix ], + # while builtins.readDir spits out { "default.nix" = "regular"; } + # In theory, this shouldn't be much of an issue, however, when using readDir + # I would be able to do `map (n: "${./.}/${n}"), while when using + # listFilesRecursive I have to use `map (n: "${n}"). + # The difference here is that when using listFilesRecursive, `n` becomes + # `/nix/store/-default.nix`, meaning it can be used as-is, but when using + # `readDir` it becomes `default.nix`, meaning the string used in the map + # callback must be `"${./.}/${n}"` to get a path to the current derivation + # where the nix file lives in. + # Currently, I am unsure of the implications of having all files separately. + # To do it "the right way" I'd obviously prefer the nix files to be children + # of the alymac derivation, but it seems that if I want my map of imports to + # be generated from the entire directory listing, it isn't going to work out. + # The solution was slightly modified from this Reddit answer: + # + # importMap = map + # (n: "${n}") + # (lib.filesystem.listFilesRecursive ./.); + # importsFiltered = + # builtins.filter + # (x: !lib.strings.hasInfix "default" x) + # importMap; + # }}} + + getDir = dir: mapAttrs + (file: type: + if type == "directory" then getDir "${dir}/${file}" else type + ) + (builtins.readDir dir); + + files = dir: collect isString (mapAttrsRecursive + (path: type: concatStringsSep "/" path) + (getDir dir)); + + validFiles = dir: map + (file: ./. + "/${file}") + (filter + (file: hasSuffix ".nix" file && file != "default.nix") + (files dir)); + +in +{ + + nix = { + package = pkgs.nix; + settings = { + experimental-features = [ "nix-command" "flakes" ]; + build-users-group = "nixbld"; + }; + gc = { + automatic = true; + options = "--delete-older-than 8d"; + }; + }; + + # Absolutely proprietary. + nixpkgs.config.allowUnfree = true; + nixpkgs.config.permittedInsecurePackages = [ + "python-2.7.18.6" + ]; + + # Make sure the nix daemon always runs + services.nix-daemon.enable = true; + + # enable the gpg agent by default + programs.gnupg.agent.enable = true; + + # if you use zsh (the default on new macOS installations), + # you'll need to enable this so nix-darwin creates a zshrc sourcing needed environment changes + programs.zsh.enable = true; + + # tailscaled isn't automatically registered as a service that should run on installation. + services.tailscale.enable = true; + + # Make sure to set the correct values, or everything will break! (in reality, + # it will just not build) + users.users.alyxia = { + name = "alyxia"; + home = "/Users/alyxia"; + }; + + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + extraSpecialArgs = { inherit self; inherit dotfiles; }; + users.alyxia = { pkgs, ... }: { + # Defined further above, generates a list of files to import. + imports = validFiles ./.; + + home = { + packages = packageSets.everything; + sessionVariables = { + EDITOR = textEditor; + }; + + file.".npmrc".text = '' + prefix = ''${HOME}/.npm-packages + ''; + }; + + # DO NOT CHANGE UNLESS YOU ARE ABSOLUTELY SURE ALL STATE AFFECTED BY THIS + # OPTION IS APPROPRIATELY MIGRATED!!! + home.stateVersion = "23.05"; # did you read the comment? + }; + }; + + homebrew = { + enable = true; + onActivation = { + autoUpdate = true; + cleanup = "zap"; + upgrade = true; + }; + + taps = [ + "drud/ddev" + "homebrew/cask-versions" + "int128/kubelogin" + ]; + + # Please do not the brew. + brews = [ + "bear" + "composer" + "croc" + "ddev" + "deno" + "dotnet" + "ferium" + "gradle" + "kubelogin" + "mkcert" + "nss" + "pinentry-mac" + "pkg-config" + "poetry" + "rustup" + "sdl2" + + # Fyra crap, but from Homebrew because someone doesn't know how to + # package libraries in nixpkgs + "appstream-glib" + "glib" + "gobject-introspection" + "gsettings-desktop-schemas" + "gtk4" + "gtksourceview5" + "libgee" + ]; + + casks = [ + "1password" + "1password-cli" + "alt-tab" + "android-studio" + "audacity" + "background-music" + "db-browser-for-sqlite" + "discord" + "discord-ptb" + "docker" + "firefox" + "firefox-developer-edition" + "goland" + "google-chrome" + "intellij-idea" + "itch" + "iterm2" + "lens" + "minecraft" + "obs" + "orbstack" + "phpstorm" + "plexamp" + "raycast" + "rider" + "rubymine" + "sequel-ace" + "shottr" + "slack" + "spotify" + "steam" + "texifier" + "thunderbird" + "transmit" + "visual-studio-code" + "wine-stable" + ]; + }; +} diff --git a/nix/home/git.nix b/nix/hosts/alymac/git.nix similarity index 100% rename from nix/home/git.nix rename to nix/hosts/alymac/git.nix diff --git a/nix/home/nvim.nix b/nix/hosts/alymac/nvim.nix similarity index 100% rename from nix/home/nvim.nix rename to nix/hosts/alymac/nvim.nix diff --git a/nix/home/zsh.nix b/nix/hosts/alymac/zsh.nix similarity index 83% rename from nix/home/zsh.nix rename to nix/hosts/alymac/zsh.nix index 777c0a6..702bb2a 100644 --- a/nix/home/zsh.nix +++ b/nix/hosts/alymac/zsh.nix @@ -10,11 +10,8 @@ [[ -d "$HOME/.local/bin" ]] || mkdir "$HOME/.local/bin" - export PATH="/Library/Developer/CommandLineTools/usr/bin:$PATH" export PATH="$PATH:$HOME/.local/bin" export PATH="$PATH:$HOME/.npm-packages/bin" - export PATH="$PATH:$HOME/.dotnet/tools" - export PATH="$PATH:$HOME/.config/composer/vendor/bin" export FRENYARD_SCALE=2.40 export RETHINK_API="https://rethink.alyxia.dev" export KUBECONFIG="$HOME/.kube/config.yaml" diff --git a/nix/lib/importAll.nix b/nix/lib/importAll.nix deleted file mode 100644 index 2db75b0..0000000 --- a/nix/lib/importAll.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ pkgs, ... }: - -exclude: cwd: with builtins; with pkgs.lib; filter - (e: !elem e exclude) - (map - (p: path.append cwd p) - (attrNames (attrsets.filterAttrs - (p: t: - let - d = t == "directory"; - b = baseNameOf p; - in - d && pathExists (path.append cwd (p + "/default.nix")) || - !d && match ''.*\.nix'' b != null && b != "default.nix") - (readDir cwd)))) diff --git a/nix/overlays/lix.nix b/nix/overlays/lix.nix deleted file mode 100644 index bde29b6..0000000 --- a/nix/overlays/lix.nix +++ /dev/null @@ -1,8 +0,0 @@ -(final: prev: { - lix = prev.lix.overrideAttrs (oldAttrs: { - postPatch = (oldAttrs.postPatch or "") + '' - substituteInPlace src/libmain/shared.cc \ - --replace-fail "(Lix, like Nix)" "but for lesbians" - ''; - }); -}) diff --git a/nix/system/default.nix b/nix/system/default.nix deleted file mode 100644 index b5d51ba..0000000 --- a/nix/system/default.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ importAll, ... }: - -{ - imports = importAll [] ./.; - - users.users.alyxia = { - name = "alyxia"; - home = "/Users/alyxia"; - }; - - # enable the gpg agent by default - programs.gnupg.agent.enable = true; - - # if you use zsh (the default on new macOS installations), - # you'll need to enable this so nix-darwin creates a zshrc sourcing needed environment changes - programs.zsh.enable = true; - - # tailscaled isn't automatically registered as a service that should run on installation. - services.tailscale.enable = true; -} diff --git a/nix/system/homebrew.nix b/nix/system/homebrew.nix deleted file mode 100644 index 98446df..0000000 --- a/nix/system/homebrew.nix +++ /dev/null @@ -1,90 +0,0 @@ -{ ... }: - -{ - homebrew = { - enable = true; - onActivation = { - autoUpdate = true; - cleanup = "zap"; - upgrade = true; - }; - - taps = [ - "drud/ddev" - "homebrew/cask-versions" - "int128/kubelogin" - ]; - - # Please do not the brew. - brews = [ - "bear" - "composer" - "croc" - "ddev" - "deno" - "dotnet" - "ferium" - "gradle" - "kubelogin" - "mkcert" - "nss" - "pinentry-mac" - "pkg-config" - "poetry" - "rustup" - "sdl2" - - # Fyra crap, but from Homebrew because someone doesn't know how to - # package libraries in nixpkgs - "appstream-glib" - "glib" - "gobject-introspection" - "gsettings-desktop-schemas" - "gtk4" - "gtksourceview5" - "libgee" - ]; - - casks = [ - "1password" - "1password-cli" - "alt-tab" - "android-studio" - "audacity" - "background-music" - "browserstacklocal" - "db-browser-for-sqlite" - "discord" - "discord-ptb" - "docker" - "firefox" - "firefox-developer-edition" - "goland" - "google-chrome" - "intellij-idea" - "itch" - "iterm2" - "lens" - "minecraft" - "obs" - "orbstack" - "phpstorm" - "plexamp" - "raycast" - "readdle-spark" - "rider" - "rubymine" - "sequel-ace" - "shottr" - "slack" - "spotify" - "steam" - "texifier" - "thunderbird" - "transmit" - "typora" - "visual-studio-code" - "wine-stable" - ]; - }; -} diff --git a/nix/system/nix.nix b/nix/system/nix.nix deleted file mode 100644 index 5bacbf3..0000000 --- a/nix/system/nix.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ ... }: - -{ - services.nix-daemon.enable = true; - - nix = { - settings.experimental-features = [ "nix-command" "flakes" ]; - gc = { - automatic = true; - options = "--delete-older-than 8d"; - }; - }; - - nixpkgs = { - config = { - allowUnfree = true; - permittedInsecurePackages = [ "python-2.7.18.8" ]; - }; - }; -}