From aaf19ee84409bd1a48d03c408dcdf66c5374f36e Mon Sep 17 00:00:00 2001 From: Amneesh Singh Date: Thu, 8 Dec 2022 01:00:12 +0530 Subject: [PATCH] massive rewrite using flake-parts Signed-off-by: Amneesh Singh --- .envrc | 1 + flake.lock | 237 ++++++------------ flake.nix | 157 +++--------- home/default.nix | 16 ++ home/modules/baremacs.nix | 166 ------------ home/natto/default.nix | 6 + .../emacs => home/natto}/gruvbox-el.patch | 0 home/natto/pkgs.nix | 14 +- home/natto/programs.nix | 1 + home/natto/services.nix | 53 ++-- home/natto/xsession.nix | 4 +- hosts/default.nix | 56 +++++ hosts/marisa/services.nix | 2 +- {modules => hosts/modules}/minpkgs.nix | 0 {modules => hosts/modules}/minzsh.nix | 2 +- {modules => hosts/modules}/nvim/default.nix | 7 +- {modules => hosts/modules}/nvim/gruvbox.patch | 0 {modules => hosts/modules}/nvim/init.lua | 0 {modules => hosts/modules}/sound.nix | 0 {modules => hosts/modules}/vault-agent.nix | 0 {modules => hosts/modules}/x86builder.nix | 0 hosts/satori/boot.nix | 3 +- hosts/satori/graphics.nix | 4 +- hosts/satori/pkgs.nix | 7 +- hosts/satori/stuff.nix | 3 +- overlays/emacs/default.nix | 22 -- {overlays => pkgs}/customscripts/default.nix | 0 {overlays => pkgs}/customscripts/src/agecrypt | 0 {overlays => pkgs}/customscripts/src/batspec | 0 .../customscripts/src/batspecup | 0 {overlays => pkgs}/customscripts/src/battrans | 0 .../customscripts/src/compmusic | 0 {overlays => pkgs}/customscripts/src/compress | 0 .../customscripts/src/dmenu_websearch | 0 {overlays => pkgs}/customscripts/src/gdfuse | 0 .../customscripts/src/listalbum | 0 {overlays => pkgs}/customscripts/src/ncm | 0 {overlays => pkgs}/customscripts/src/osusens | 0 {overlays => pkgs}/customscripts/src/up | 0 {overlays => pkgs}/customscripts/src/x0 | 0 {overlays => pkgs}/customscripts/src/ytmp3 | 0 pkgs/default.nix | 14 ++ {overlays => pkgs}/packages.nix | 1 - {overlays => pkgs}/simp1e/default.nix | 0 {overlays => pkgs}/tlauncher/default.nix | 0 45 files changed, 245 insertions(+), 531 deletions(-) create mode 100644 .envrc create mode 100644 home/default.nix delete mode 100644 home/modules/baremacs.nix rename {overlays/emacs => home/natto}/gruvbox-el.patch (100%) create mode 100644 hosts/default.nix rename {modules => hosts/modules}/minpkgs.nix (100%) rename {modules => hosts/modules}/minzsh.nix (96%) rename {modules => hosts/modules}/nvim/default.nix (80%) rename {modules => hosts/modules}/nvim/gruvbox.patch (100%) rename {modules => hosts/modules}/nvim/init.lua (100%) rename {modules => hosts/modules}/sound.nix (100%) rename {modules => hosts/modules}/vault-agent.nix (100%) rename {modules => hosts/modules}/x86builder.nix (100%) delete mode 100644 overlays/emacs/default.nix rename {overlays => pkgs}/customscripts/default.nix (100%) rename {overlays => pkgs}/customscripts/src/agecrypt (100%) rename {overlays => pkgs}/customscripts/src/batspec (100%) rename {overlays => pkgs}/customscripts/src/batspecup (100%) rename {overlays => pkgs}/customscripts/src/battrans (100%) rename {overlays => pkgs}/customscripts/src/compmusic (100%) rename {overlays => pkgs}/customscripts/src/compress (100%) rename {overlays => pkgs}/customscripts/src/dmenu_websearch (100%) rename {overlays => pkgs}/customscripts/src/gdfuse (100%) rename {overlays => pkgs}/customscripts/src/listalbum (100%) rename {overlays => pkgs}/customscripts/src/ncm (100%) rename {overlays => pkgs}/customscripts/src/osusens (100%) rename {overlays => pkgs}/customscripts/src/up (100%) rename {overlays => pkgs}/customscripts/src/x0 (100%) rename {overlays => pkgs}/customscripts/src/ytmp3 (100%) create mode 100644 pkgs/default.nix rename {overlays => pkgs}/packages.nix (85%) rename {overlays => pkgs}/simp1e/default.nix (100%) rename {overlays => pkgs}/tlauncher/default.nix (100%) diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/flake.lock b/flake.lock index 2162ea7..5067941 100644 --- a/flake.lock +++ b/flake.lock @@ -16,17 +16,17 @@ "type": "gitlab" } }, - "emacs": { + "emacs-overlay": { "inputs": { "flake-utils": "flake-utils", "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1670295974, - "narHash": "sha256-+oQzBTxrWag9XnIndTUXvilI78fuIlhRQ+iNtBrlUF8=", + "lastModified": 1670438727, + "narHash": "sha256-c8SAz45BtQTZLxX0BRoj7aGlk6jogjlTE7Tj40lQr6Q=", "owner": "nix-community", "repo": "emacs-overlay", - "rev": "2f7fff8ee668c01803cab2f0847151fdf647134e", + "rev": "e9c4d10bbb4e810cbfe5e31248fe835e08efb35a", "type": "github" }, "original": { @@ -51,6 +51,24 @@ "type": "github" } }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1668450977, + "narHash": "sha256-cfLhMhnvXn6x1vPm+Jow3RiFAUSCw/l1utktCw5rVA4=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "d591857e9d7dd9ddbfba0ea02b43b927c3c0f1fa", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "flake-utils": { "locked": { "lastModified": 1667395993, @@ -115,29 +133,10 @@ "type": "github" } }, - "home-manager-stable": { - "inputs": { - "nixpkgs": "nixpkgs_3" - }, - "locked": { - "lastModified": 1651519540, - "narHash": "sha256-3k6p8VsTwwRPQjE8rrMh+o2AZACZn/eeYJ7ivdQ/Iro=", - "owner": "nix-community", - "repo": "home-manager", - "rev": "d93d56ab8c1c6aa575854a79b9d2f69d491db7d0", - "type": "github" - }, - "original": { - "owner": "nix-community", - "ref": "release-21.11", - "repo": "home-manager", - "type": "github" - } - }, "mailserver": { "inputs": { "blobs": "blobs", - "nixpkgs": "nixpkgs_4", + "nixpkgs": "nixpkgs_3", "nixpkgs-22_05": "nixpkgs-22_05", "utils": "utils_2" }, @@ -155,25 +154,9 @@ "type": "gitlab" } }, - "master": { - "locked": { - "lastModified": 1670329699, - "narHash": "sha256-a2COGA8sIwGtiShuO8T8fgT+MhOhpGYdsywJP34DUEg=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "2be8b0ec2fa3fc02c3fe6ed608d29743a1fd76e0", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "master", - "repo": "nixpkgs", - "type": "github" - } - }, "nbfc": { "inputs": { - "nixpkgs": "nixpkgs_5", + "nixpkgs": "nixpkgs_4", "utils": "utils_3" }, "locked": { @@ -194,17 +177,17 @@ "inputs": { "flake-utils": "flake-utils_2", "nixpkgs": [ - "nvim", + "nvim-overlay", "nixpkgs" ] }, "locked": { "dir": "contrib", - "lastModified": 1670297660, - "narHash": "sha256-OB1P48rxsqSqB50yTyvy75sLS5AdmJvtdRXtgCl5D8U=", + "lastModified": 1670395896, + "narHash": "sha256-Nz4ZCPER+Z1JGMf5XDJAcssr/wg6h7PASwy6baym8kY=", "owner": "neovim", "repo": "neovim", - "rev": "6d7b94ea086e17d16e2490e56572f17031924af5", + "rev": "0caae2376e6c8f6665143e77e4e7a0cdf2b054c4", "type": "github" }, "original": { @@ -216,7 +199,7 @@ }, "nix-gaming": { "inputs": { - "nixpkgs": "nixpkgs_6" + "nixpkgs": "nixpkgs_5" }, "locked": { "lastModified": 1670183910, @@ -261,6 +244,24 @@ "type": "indirect" } }, + "nixpkgs-lib": { + "locked": { + "dir": "lib", + "lastModified": 1665349835, + "narHash": "sha256-UK4urM3iN80UXQ7EaOappDzcisYIuEURFRoGQ/yPkug=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "34c5293a71ffdb2fe054eb5288adc1882c1eb0b1", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs_2": { "locked": { "lastModified": 1669969257, @@ -278,20 +279,6 @@ } }, "nixpkgs_3": { - "locked": { - "lastModified": 1670047204, - "narHash": "sha256-5NcSGchQbl9DKMQ31qmgfscmrAg7qilJF/no2nBSRzs=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "809f15f2e7fd66c3d3ba6aabffa946fbd67f93fc", - "type": "github" - }, - "original": { - "id": "nixpkgs", - "type": "indirect" - } - }, - "nixpkgs_4": { "locked": { "lastModified": 1642635915, "narHash": "sha256-vabPA32j81xBO5m3+qXndWp5aqepe+vu96Wkd9UnngM=", @@ -306,7 +293,7 @@ "type": "indirect" } }, - "nixpkgs_5": { + "nixpkgs_4": { "locked": { "lastModified": 1646811357, "narHash": "sha256-JJdz8QJ8Gz9ZChGfl4P9Cm8C9mYJLRGVsXcY9gNPtuI=", @@ -321,7 +308,7 @@ "type": "github" } }, - "nixpkgs_6": { + "nixpkgs_5": { "locked": { "lastModified": 1663491030, "narHash": "sha256-MVsfBhE9US5DvLtBAaTRjwYdv1tLO8xjahM8qLXTgTo=", @@ -337,7 +324,7 @@ "type": "github" } }, - "nixpkgs_7": { + "nixpkgs_6": { "locked": { "lastModified": 1670235252, "narHash": "sha256-5YWCit/Brz4EDT/TIwXT/5wxRxb+cz1Nls7ZodQeKiw=", @@ -353,13 +340,13 @@ "type": "github" } }, - "nixpkgs_8": { + "nixpkgs_7": { "locked": { - "lastModified": 1670148586, - "narHash": "sha256-EcDfOiTHs0UBAtyGc0wxJJdhcMjrJEgWXjJutxZGA3E=", + "lastModified": 1670267727, + "narHash": "sha256-hUFAn5gjNHIBpLQT0CmqpuQjQwgWUm+D6aziGAYsDmw=", "owner": "nixos", "repo": "nixpkgs", - "rev": "a2d2f70b82ada0eadbcb1df2bca32d841a3c1bf1", + "rev": "a5f661b80e4c163510a5013b585a040a5c7ef55e", "type": "github" }, "original": { @@ -369,7 +356,7 @@ "type": "github" } }, - "nixpkgs_9": { + "nixpkgs_8": { "locked": { "lastModified": 1665296151, "narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=", @@ -385,33 +372,18 @@ "type": "github" } }, - "nur": { - "locked": { - "lastModified": 1670315682, - "narHash": "sha256-/v0RgZZIjvsFuJbJLUlzRbzSlYFXq3olgJTuJBNtcoY=", - "owner": "nix-community", - "repo": "NUR", - "rev": "af814db16c89385c65e758608296440555f61ccc", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "NUR", - "type": "github" - } - }, - "nvim": { + "nvim-overlay": { "inputs": { "flake-compat": "flake-compat", "neovim-flake": "neovim-flake", - "nixpkgs": "nixpkgs_8" + "nixpkgs": "nixpkgs_7" }, "locked": { - "lastModified": 1670314513, - "narHash": "sha256-NfUfsaA9RaTQWTjv1fMHqPkcI1u3rqddUPLLX4s47ZM=", + "lastModified": 1670400905, + "narHash": "sha256-g7zvYhGPxqZnrueTo1NR7AU1j1ejatDO9W6GGzAfk6o=", "owner": "nix-community", "repo": "neovim-nightly-overlay", - "rev": "66d0dd530766c323b5cb177773409be387231238", + "rev": "36b9905aa2f520da2be8703ffcd887b7f1162f72", "type": "github" }, "original": { @@ -420,52 +392,30 @@ "type": "github" } }, - "old": { - "locked": { - "lastModified": 1670083709, - "narHash": "sha256-UL4czXyVoKSCqAbNkfJEu2M+XhIVNwBGkyDt+UbtA5E=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "e09913998d89659044c29ef5df4a86542e78a2ef", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-22.05", - "repo": "nixpkgs", - "type": "github" - } - }, "root": { "inputs": { - "emacs": "emacs", + "emacs-overlay": "emacs-overlay", + "flake-parts": "flake-parts", "home-manager": "home-manager", - "home-manager-stable": "home-manager-stable", "mailserver": "mailserver", - "master": "master", "nbfc": "nbfc", "nix-gaming": "nix-gaming", - "nixpkgs": "nixpkgs_7", - "nur": "nur", - "nvim": "nvim", - "old": "old", - "rust": "rust", - "stable": "stable", - "stable-small": "stable-small", - "utils": "utils_4" + "nixpkgs": "nixpkgs_6", + "nvim-overlay": "nvim-overlay", + "rust-overlay": "rust-overlay" } }, - "rust": { + "rust-overlay": { "inputs": { "flake-utils": "flake-utils_3", - "nixpkgs": "nixpkgs_9" + "nixpkgs": "nixpkgs_8" }, "locked": { - "lastModified": 1670293639, - "narHash": "sha256-RkPLwza77YkFgxKHGzfYAYVKiD9SeIvsOA7+ihiySwI=", + "lastModified": 1670380307, + "narHash": "sha256-7fJN5ndnE8YbrrtYdqMo3gDV/BW37M4wNBRhjdfP/XY=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "9767af967a0becaa3bb79eeda838dbf81295eb62", + "rev": "fc98242f5f49d39b8fd3a611c146741a35dc012d", "type": "github" }, "original": { @@ -474,38 +424,6 @@ "type": "github" } }, - "stable": { - "locked": { - "lastModified": 1670193339, - "narHash": "sha256-oHTAhX4p6+uxcabq0rKL4EyKWPbDLGKec88ocPIU/2Y=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "e169cf5b3b1e6cc4a25ff15087c2621605f83409", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-22.11", - "repo": "nixpkgs", - "type": "github" - } - }, - "stable-small": { - "locked": { - "lastModified": 1670169715, - "narHash": "sha256-ZWekhqQrt9wETxTz19LssfeW6zzUOIG1fq6j+Ri0V3k=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "7187c12972bde6e2c00a3dae864e1aa92efcc316", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-22.05-small", - "repo": "nixpkgs", - "type": "github" - } - }, "utils": { "locked": { "lastModified": 1667395993, @@ -550,21 +468,6 @@ "repo": "flake-utils", "type": "github" } - }, - "utils_4": { - "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 82ccbae..53a38af 100644 --- a/flake.nix +++ b/flake.nix @@ -1,144 +1,43 @@ { + description = "dotfiles"; + inputs = { - stable.url = github:nixos/nixpkgs/nixos-22.11; - stable-small.url = github:nixos/nixpkgs/nixos-22.05-small; - old.url = github:nixos/nixpkgs/nixos-22.05; nixpkgs.url = github:nixos/nixpkgs/nixpkgs-unstable; - master.url = github:nixos/nixpkgs/master; home-manager.url = github:nix-community/home-manager; - home-manager-stable.url = github:nix-community/home-manager/release-21.11; - nur.url = github:nix-community/NUR; - utils.url = github:numtide/flake-utils; - nvim.url = github:nix-community/neovim-nightly-overlay; + flake-parts.url = github:hercules-ci/flake-parts; + nvim-overlay.url = github:nix-community/neovim-nightly-overlay; mailserver.url = gitlab:simple-nixos-mailserver/nixos-mailserver; - nbfc.url = github:nbfc-linux/nbfc-linux; - emacs.url = github:nix-community/emacs-overlay; + emacs-overlay.url = github:nix-community/emacs-overlay; + rust-overlay.url = github:oxalica/rust-overlay; nix-gaming.url = github:fufexan/nix-gaming; - rust.url = github:oxalica/rust-overlay; + nbfc.url = github:nbfc-linux/nbfc-linux; }; - outputs = inputs@{ self, utils, nixpkgs, stable, master, old, stable-small, ... }: - with utils.lib; eachSystem - (with system; - [ x86_64-linux aarch64-linux ]) - (system: - let - mkPkgs = channel: system: import channel { - inherit system; - config.allowUnfree = true; - config.allowBroken = true; - }; - channels = final: prev: { - stable = mkPkgs stable prev.system; - stable-small = mkPkgs stable-small prev.system; - unstable = mkPkgs nixpkgs prev.system; - master = mkPkgs master prev.system; - old = mkPkgs old prev.system; - }; + outputs = inputs@{ self, nixpkgs, ... }: + inputs.flake-parts.lib.mkFlake { inherit self; } { + systems = [ "x86_64-linux" "aarch64-linux" ]; + imports = [ + ./hosts + ./home + ./pkgs + ]; + + perSystem = { pkgs, system, ... }: rec { + legacyPackages = import inputs.nixpkgs { + inherit system; + config.allowUnfree = true; overlays = [ - (import ./overlays/packages.nix) + inputs.nvim-overlay.overlay + inputs.emacs-overlay.overlay + inputs.rust-overlay.overlays.default ]; - in - { - legacyPackages = import nixpkgs { - inherit system; - overlays = overlays ++ [ - inputs.nur.overlay - inputs.nvim.overlay - inputs.rust.overlays.default - inputs.emacs.overlay - channels - (_: _: { - nbfc-linux = inputs.nbfc.packages.${system}.nbfc-client-c; - gaming = inputs.nix-gaming.packages.${system}; - }) - ]; - config.allowUnfree = true; - config.allowBroken = true; - }; - }) // - ( - let - personalModules = [ - ./modules/sound.nix - ]; - commonModules = [ - ./modules/nvim - ./modules/vault-agent.nix - ]; - serverModules = [ - ./modules/minpkgs.nix - ./modules/minzsh.nix - ]; - homeModules = [ - ./home/modules/secret.nix - ./home/modules/baremacs.nix - ]; - builders = [ ./modules/x86builder.nix ]; - in - { - homeConfigurations = { - natto = inputs.home-manager.lib.homeManagerConfiguration { - modules = [ - ./home/natto - { - home = { - homeDirectory = "/home/natto"; - username = "natto"; - packages = [ - inputs.home-manager.defaultPackage.x86_64-linux - ]; - stateVersion = "22.05"; - }; - } - ] ++ homeModules; - pkgs = self.legacyPackages.x86_64-linux; - }; }; - nixosConfigurations = { - #Home laptop - satori = nixpkgs.lib.nixosSystem rec { - system = "x86_64-linux"; - modules = [ - ./hosts/satori - { - nixpkgs.pkgs = self.legacyPackages.${system}; - } - ] - ++ personalModules - ++ commonModules; - }; + formatter = pkgs.nixpkgs-fmt; - #Home server (RPi4) - marisa = nixpkgs.lib.nixosSystem rec { - system = "aarch64-linux"; - modules = [ - ./hosts/marisa - #inputs.mailserver.nixosModules.mailserver - { - nixpkgs.pkgs = self.legacyPackages.${system}; - } - ] - ++ commonModules - ++ serverModules; - }; - - #Oracle Cloud VM - remilia = nixpkgs.lib.nixosSystem rec { - system = "x86_64-linux"; - modules = [ - ./hosts/remilia - inputs.mailserver.nixosModules.mailserver - { - nixpkgs.pkgs = self.legacyPackages.${system}; - } - ] - ++ commonModules - ++ serverModules - ++ builders; - }; + devShells.default = pkgs.mkShell { + packages = [ formatter ]; }; - } - ); + }; + }; } diff --git a/home/default.nix b/home/default.nix new file mode 100644 index 0000000..7b7cc83 --- /dev/null +++ b/home/default.nix @@ -0,0 +1,16 @@ +{ self, inputs, ... }: +{ + flake.homeConfigurations = { + natto = inputs.home-manager.lib.homeManagerConfiguration { + modules = [ + ./natto + ./modules/secret.nix + ]; + pkgs = self.legacyPackages.x86_64-linux; + extraSpecialArgs = { + inherit inputs; + flake = self; + }; + }; + }; +} diff --git a/home/modules/baremacs.nix b/home/modules/baremacs.nix deleted file mode 100644 index f2b920a..0000000 --- a/home/modules/baremacs.nix +++ /dev/null @@ -1,166 +0,0 @@ -#modified version of home-manager emacs service module for personal use - -{ config, lib, pkgs, ... }: - -with lib; - -let - cfg = config.services.baremacs; - emacsCfg = config.programs.emacs; - emacsBinPath = "${cfg.package}/bin"; - - # Match the default socket path for the Emacs version so emacsclient continues - # to work without wrapping it. - socketDir = "%t/emacs"; - socketPath = "${socketDir}/server"; - -in -{ - options.services.baremacs = { - enable = mkEnableOption "the Emacs daemon"; - - package = mkOption { - type = types.package; - default = pkgs.emacs; - defaultText = literalExpression '' - pkgs.emacs - ''; - description = "The Emacs package to use."; - }; - - socketActivation = { - enable = mkEnableOption "systemd socket activation for the Emacs service"; - }; - - defaultEditor = { - enable = mkOption rec { - type = types.bool; - default = false; - example = !default; - description = "Whether to change the EDITOR environment variable or not"; - }; - editor = mkOption rec { - type = types.enum [ "emacs" "emacsclient" ]; - default = null; - example = "emacsclient"; - description = "Whether to change the EDITOR environment variable or not"; - }; - }; - - copyConfigFiles = { - enable = mkOption rec { - type = types.bool; - default = false; - example = !default; - description = "Whether to copy the config files to ~/.emacs.d or not"; - }; - files = mkOption rec { - type = types.attrsOf types.path; - default = { }; - example = { "init.el" = ./init.el; }; - description = "What files to copy under what name"; - }; - }; - }; - - config = mkIf cfg.enable (mkMerge [ - { - assertions = [ - (lib.hm.assertions.assertPlatform "services.emacs" pkgs - lib.platforms.linux) - { - assertion = cfg.defaultEditor.enable -> cfg.defaultEditor.editor != null; - message = '' - services.baremacs.defaultEditor.enable requires services.baremacs.defaultEditor.editor to be set - ''; - } - ]; - - systemd.user.services.emacs = { - Unit = { - Description = "Emacs text editor"; - Documentation = - "info:emacs man:emacs(1) https://gnu.org/software/emacs/"; - - # Avoid killing the Emacs session, which may be full of - # unsaved buffers. - X-RestartIfChanged = false; - } // optionalAttrs (cfg.socketActivation.enable) { - # Emacs deletes its socket when shutting down, which systemd doesn't - # handle, resulting in a server without a socket. - # See https://github.com/nix-community/home-manager/issues/2018 - RefuseManualStart = true; - }; - - Service = { - Type = "notify"; - - # We wrap ExecStart in a login shell so Emacs starts with the user's - # environment, most importantly $PATH and $NIX_PROFILES. It may be - # worth investigating a more targeted approach for user services to - # iport the user environment. - ExecStart = '' - ${pkgs.runtimeShell} -l -c "${emacsBinPath}/emacs --fg-daemon${ - # In case the user sets 'server-directory' or 'server-name' in - # their Emacs config, we want to specify the socket path explicitly - # so launching 'emacs.service' manually doesn't break emacsclient - # when using socket activation. - optionalString cfg.socketActivation.enable - "=${escapeShellArg socketPath}" - }"''; - - # Emacs will exit with status 15 after having received SIGTERM, which - # is the default "KillSignal" value systemd uses to stop services. - SuccessExitStatus = 15; - - Restart = "on-failure"; - } // optionalAttrs (cfg.socketActivation.enable) { - # Use read-only directory permissions to prevent emacs from - # deleting systemd's socket file before exiting. - ExecStartPost = - "${pkgs.coreutils}/bin/chmod --changes -w ${socketDir}"; - ExecStopPost = - "${pkgs.coreutils}/bin/chmod --changes +w ${socketDir}"; - }; - } // optionalAttrs (!cfg.socketActivation.enable) { - Install = { WantedBy = [ "default.target" ]; }; - }; - - home = { - sessionVariables = mkIf cfg.defaultEditor.enable { - EDITOR = let editor = cfg.defaultEditor.editor; in - getBin (pkgs.writeShellScript "editor" '' - exec ${ - getBin cfg.package - }/bin/'' + editor + head (optional (editor == "emacsclient") '' "''${@:---create-frame}"'')); - }; - - packages = [ cfg.package ]; - - file = mkIf cfg.copyConfigFiles.enable - (mapAttrs' - (n: v: - attrsets.nameValuePair (".emacs.d/" + n) { source = v; }) - cfg.copyConfigFiles.files); - }; - } - - (mkIf cfg.socketActivation.enable { - systemd.user.sockets.emacs = { - Unit = { - Description = "Emacs text editor"; - Documentation = - "info:emacs man:emacs(1) https://gnu.org/software/emacs/"; - }; - - Socket = { - ListenStream = socketPath; - FileDescriptorName = "server"; - SocketMode = "0600"; - DirectoryMode = "0700"; - }; - Install = { WantedBy = [ "sockets.target" ]; }; - }; - }) - ]); -} diff --git a/home/natto/default.nix b/home/natto/default.nix index 69e256a..4b3aae0 100644 --- a/home/natto/default.nix +++ b/home/natto/default.nix @@ -1,5 +1,11 @@ { config, pkgs, lib, ... }: { + home = { + homeDirectory = "/home/natto"; + username = "natto"; + stateVersion = "22.11"; + }; + imports = [ ./email.nix ./secrets diff --git a/overlays/emacs/gruvbox-el.patch b/home/natto/gruvbox-el.patch similarity index 100% rename from overlays/emacs/gruvbox-el.patch rename to home/natto/gruvbox-el.patch diff --git a/home/natto/pkgs.nix b/home/natto/pkgs.nix index 1017561..4de6dd4 100644 --- a/home/natto/pkgs.nix +++ b/home/natto/pkgs.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ config, flake, inputs, pkgs, ... }: { home.packages = with pkgs; [ @@ -36,8 +36,8 @@ jmtpfs neofetch xdotool - nbfc-linux - customscripts + (inputs.nbfc.packages.${pkgs.system}.nbfc-client-c) + (flake.packages.${pkgs.system}.customscripts) # GUI utils (xfce.thunar.override { @@ -50,7 +50,7 @@ xfce.xfconf xfce.tumbler flameshot - (master.discord.override { + (discord.override { nss = nss_latest; }) qbittorrent @@ -69,12 +69,12 @@ # Wine and games and stuff wineWowPackages.stable - master.winetricks - tlauncher + winetricks citra yuzu ryujinx - gaming.osu-stable + (inputs.nix-gaming.packages.${pkgs.system}.osu-stable) + (flake.packages.${pkgs.system}.tlauncher) # Dev shit rust-analyzer diff --git a/home/natto/programs.nix b/home/natto/programs.nix index 7a7c2e9..ee021f7 100644 --- a/home/natto/programs.nix +++ b/home/natto/programs.nix @@ -1,6 +1,7 @@ { pkgs, config, ... }: { programs = { + home-manager.enable = true; firefox = { enable = true; profiles.natto = { diff --git a/home/natto/services.nix b/home/natto/services.nix index e65ea87..91c3505 100644 --- a/home/natto/services.nix +++ b/home/natto/services.nix @@ -1,26 +1,35 @@ -{ config, pkgs, ... }: -let - home = config.home.homeDirectory; -in +{ config, pkgs, inputs, ... }: { - services = { - baremacs = { - enable = true; - package = pkgs.mymacs.override { - config = ./config/emacs/config.org; - }; - defaultEditor = { - enable = false; - editor = "emacsclient"; - }; - copyConfigFiles = { - enable = true; - files = { - "config.org" = ./config/emacs/config.org; - "init.el" = ./config/emacs/init.el; - }; - }; + home.file = with config; { + "config.org" = { + source = ./config/emacs/config.org; + target = "${home.homeDirectory}/.emacs.d/config.org"; }; + "init.el" = { + source = ./config/emacs/init.el; + target = "${home.homeDirectory}/.emacs.d/init.el"; + }; + }; + + services = { + emacs = + let + mymacs = config: # with inputs.emacs-overlay.packages.${pkgs.system}; already resolved with overlay + with pkgs; emacsWithPackagesFromUsePackage { + inherit config; + package = emacsGit; + alwaysEnsure = true; + alwaysTangle = true; + extraEmacsPackages = epkgs: with epkgs; [ + use-package + (epkgs.tree-sitter-langs.withPlugins (_: epkgs.tree-sitter-langs.plugins)) + ]; + }; + in + { + enable = true; + package = mymacs ./config/emacs/config.org; + }; sxhkd = { enable = false; @@ -80,7 +89,7 @@ in background = "#dc322f"; foreground = "#eee8d5"; timeout = 0; - }; + }; }; }; diff --git a/home/natto/xsession.nix b/home/natto/xsession.nix index e761409..3ab57ee 100644 --- a/home/natto/xsession.nix +++ b/home/natto/xsession.nix @@ -1,7 +1,7 @@ -{ pkgs, config, ... }: +{ pkgs, config, flake, ... }: { home.pointerCursor = { - package = pkgs.simp1e-cursors; + package = flake.packages.${pkgs.system}.simp1e-cursors; name = "Simp1e-Solarized-Light"; x11 = { enable = true; diff --git a/hosts/default.nix b/hosts/default.nix new file mode 100644 index 0000000..9ee0519 --- /dev/null +++ b/hosts/default.nix @@ -0,0 +1,56 @@ +{ self, inputs, ... }: +let + inherit (inputs) nixpkgs; + specialArgs = { inherit inputs; }; + + commonModules = [ ./modules/nvim ]; + personalModules = [ ./modules/sound.nix ]; + serverModules = [ + ./modules/minpkgs.nix + ./modules/minzsh.nix + ]; + builders = [ + ./modules/x86builder.nix + ]; +in +{ + flake.nixosConfigurations = { + #Home laptop + satori = nixpkgs.lib.nixosSystem rec { + system = "x86_64-linux"; + inherit specialArgs; + modules = [ + ./satori + { nixpkgs.pkgs = self.legacyPackages.${system}; } + ] + ++ personalModules + ++ commonModules; + }; + + #Home server (RPi4) + marisa = nixpkgs.lib.nixosSystem rec { + system = "aarch64-linux"; + inherit specialArgs; + modules = [ + ./marisa + { nixpkgs.pkgs = self.legacyPackages.${system}; } + ] + ++ commonModules + ++ serverModules; + }; + + #Oracle Cloud VM + remilia = nixpkgs.lib.nixosSystem rec { + system = "x86_64-linux"; + inherit specialArgs; + modules = [ + ./remilia + inputs.mailserver.nixosModules.mailserver + { nixpkgs.pkgs = self.legacyPackages.${system}; } + ] + ++ commonModules + ++ serverModules + ++ builders; + }; + }; +} diff --git a/hosts/marisa/services.nix b/hosts/marisa/services.nix index c182492..723aa40 100644 --- a/hosts/marisa/services.nix +++ b/hosts/marisa/services.nix @@ -34,7 +34,7 @@ consul = { enable = true; - package = pkgs.master.consul; + package = pkgs.consul; extraConfigFiles = lib.singleton "/run/consul/consul.json"; }; }; diff --git a/modules/minpkgs.nix b/hosts/modules/minpkgs.nix similarity index 100% rename from modules/minpkgs.nix rename to hosts/modules/minpkgs.nix diff --git a/modules/minzsh.nix b/hosts/modules/minzsh.nix similarity index 96% rename from modules/minzsh.nix rename to hosts/modules/minzsh.nix index 251c481..e07ff54 100644 --- a/modules/minzsh.nix +++ b/hosts/modules/minzsh.nix @@ -1,4 +1,4 @@ -{ config }: +{ config, ... }: { programs = { zsh = { diff --git a/modules/nvim/default.nix b/hosts/modules/nvim/default.nix similarity index 80% rename from modules/nvim/default.nix rename to hosts/modules/nvim/default.nix index ea703a2..699f3cd 100644 --- a/modules/nvim/default.nix +++ b/hosts/modules/nvim/default.nix @@ -1,9 +1,10 @@ -{ config, pkgs, ... }: +{inputs, config, pkgs, ... }: { programs.neovim = { enable = true; package = pkgs.neovim-nightly; + # package = inputs.nvim-overlay.packages.${pkgs.system}.default; # package = pkgs.neovim-nightly.overrideAttrs (_:{ # nativeBuildInputs = with pkgs; [ unzip cmake pkgconfig gettext tree-sitter ]; # }); @@ -14,7 +15,7 @@ ${builtins.readFile ./init.lua} EOF ''; - packages.myVimPackage = with pkgs.unstable.vimPlugins; { + packages.myVimPackage = with pkgs.vimPlugins; { start = [ nvim-colorizer-lua bracey-vim @@ -37,7 +38,7 @@ presence-nvim nvim-web-devicons nvim-tree-lua - (nvim-treesitter.withPlugins (plugins: pkgs.unstable.tree-sitter.allGrammars)) + (nvim-treesitter.withPlugins (plugins: pkgs.tree-sitter.allGrammars)) vim-latex-live-preview lspkind-nvim base16-vim diff --git a/modules/nvim/gruvbox.patch b/hosts/modules/nvim/gruvbox.patch similarity index 100% rename from modules/nvim/gruvbox.patch rename to hosts/modules/nvim/gruvbox.patch diff --git a/modules/nvim/init.lua b/hosts/modules/nvim/init.lua similarity index 100% rename from modules/nvim/init.lua rename to hosts/modules/nvim/init.lua diff --git a/modules/sound.nix b/hosts/modules/sound.nix similarity index 100% rename from modules/sound.nix rename to hosts/modules/sound.nix diff --git a/modules/vault-agent.nix b/hosts/modules/vault-agent.nix similarity index 100% rename from modules/vault-agent.nix rename to hosts/modules/vault-agent.nix diff --git a/modules/x86builder.nix b/hosts/modules/x86builder.nix similarity index 100% rename from modules/x86builder.nix rename to hosts/modules/x86builder.nix diff --git a/hosts/satori/boot.nix b/hosts/satori/boot.nix index 7f2838b..3940c4f 100644 --- a/hosts/satori/boot.nix +++ b/hosts/satori/boot.nix @@ -3,8 +3,7 @@ { boot = { supportedFilesystems = [ "zfs" ]; - - kernelPackages = pkgs.unstable.linuxPackages_latest; + kernelPackages = pkgs.linuxPackages_latest; initrd = { availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "sd_mod" "vfio-pci" ]; /* preDeviceCommands = '' diff --git a/hosts/satori/graphics.nix b/hosts/satori/graphics.nix index 22f1a7a..dad5500 100644 --- a/hosts/satori/graphics.nix +++ b/hosts/satori/graphics.nix @@ -16,8 +16,8 @@ in opengl = { driSupport32Bit = true; enable = true; - package = pkgs.master.mesa.drivers; - package32 = pkgs.master.pkgsi686Linux.mesa.drivers; + package = pkgs.mesa.drivers; + package32 = pkgs.pkgsi686Linux.mesa.drivers; }; nvidia = { package = config.boot.kernelPackages.nvidia_x11; diff --git a/hosts/satori/pkgs.nix b/hosts/satori/pkgs.nix index 31a11da..37bfa27 100644 --- a/hosts/satori/pkgs.nix +++ b/hosts/satori/pkgs.nix @@ -1,4 +1,4 @@ -{ lib, config, pkgs, ... }: +{ lib, config, inputs, pkgs, ... }: { environment.systemPackages = with pkgs; [ @@ -18,11 +18,10 @@ cachix gcc glibc.static - stable.openjdk + openjdk virtmanager tree-sitter docker-compose - nodePackages.typescript rust-bin.nightly.latest.default clang-tools rnix-lsp @@ -44,7 +43,7 @@ }; git = { enable = true; - package = pkgs.master.git.override { + package = pkgs.git.override { doInstallCheck = false; sendEmailSupport = true; withManual = false; diff --git a/hosts/satori/stuff.nix b/hosts/satori/stuff.nix index 19cb27d..3e9f358 100644 --- a/hosts/satori/stuff.nix +++ b/hosts/satori/stuff.nix @@ -45,9 +45,8 @@ font-awesome monoid office-code-pro - hanazono eb-garamond - # noto-fonts-cjk + noto-fonts-cjk ]; users.users.natto = { isNormalUser = true; diff --git a/overlays/emacs/default.nix b/overlays/emacs/default.nix deleted file mode 100644 index 4a216e0..0000000 --- a/overlays/emacs/default.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ emacsWithPackagesFromUsePackage -, stdenv -, fetchzip -, fetchurl -, fetchFromGitHub -, emacsNativeComp -, config ? null -, package ? emacsNativeComp -, ... -}: - -assert (config != null); - -emacsWithPackagesFromUsePackage { - inherit config package; - alwaysEnsure = true; - alwaysTangle = true; - extraEmacsPackages = epkgs: with epkgs; [ - use-package - (epkgs.tree-sitter-langs.withPlugins (_: epkgs.tree-sitter-langs.plugins)) - ]; -} diff --git a/overlays/customscripts/default.nix b/pkgs/customscripts/default.nix similarity index 100% rename from overlays/customscripts/default.nix rename to pkgs/customscripts/default.nix diff --git a/overlays/customscripts/src/agecrypt b/pkgs/customscripts/src/agecrypt similarity index 100% rename from overlays/customscripts/src/agecrypt rename to pkgs/customscripts/src/agecrypt diff --git a/overlays/customscripts/src/batspec b/pkgs/customscripts/src/batspec similarity index 100% rename from overlays/customscripts/src/batspec rename to pkgs/customscripts/src/batspec diff --git a/overlays/customscripts/src/batspecup b/pkgs/customscripts/src/batspecup similarity index 100% rename from overlays/customscripts/src/batspecup rename to pkgs/customscripts/src/batspecup diff --git a/overlays/customscripts/src/battrans b/pkgs/customscripts/src/battrans similarity index 100% rename from overlays/customscripts/src/battrans rename to pkgs/customscripts/src/battrans diff --git a/overlays/customscripts/src/compmusic b/pkgs/customscripts/src/compmusic similarity index 100% rename from overlays/customscripts/src/compmusic rename to pkgs/customscripts/src/compmusic diff --git a/overlays/customscripts/src/compress b/pkgs/customscripts/src/compress similarity index 100% rename from overlays/customscripts/src/compress rename to pkgs/customscripts/src/compress diff --git a/overlays/customscripts/src/dmenu_websearch b/pkgs/customscripts/src/dmenu_websearch similarity index 100% rename from overlays/customscripts/src/dmenu_websearch rename to pkgs/customscripts/src/dmenu_websearch diff --git a/overlays/customscripts/src/gdfuse b/pkgs/customscripts/src/gdfuse similarity index 100% rename from overlays/customscripts/src/gdfuse rename to pkgs/customscripts/src/gdfuse diff --git a/overlays/customscripts/src/listalbum b/pkgs/customscripts/src/listalbum similarity index 100% rename from overlays/customscripts/src/listalbum rename to pkgs/customscripts/src/listalbum diff --git a/overlays/customscripts/src/ncm b/pkgs/customscripts/src/ncm similarity index 100% rename from overlays/customscripts/src/ncm rename to pkgs/customscripts/src/ncm diff --git a/overlays/customscripts/src/osusens b/pkgs/customscripts/src/osusens similarity index 100% rename from overlays/customscripts/src/osusens rename to pkgs/customscripts/src/osusens diff --git a/overlays/customscripts/src/up b/pkgs/customscripts/src/up similarity index 100% rename from overlays/customscripts/src/up rename to pkgs/customscripts/src/up diff --git a/overlays/customscripts/src/x0 b/pkgs/customscripts/src/x0 similarity index 100% rename from overlays/customscripts/src/x0 rename to pkgs/customscripts/src/x0 diff --git a/overlays/customscripts/src/ytmp3 b/pkgs/customscripts/src/ytmp3 similarity index 100% rename from overlays/customscripts/src/ytmp3 rename to pkgs/customscripts/src/ytmp3 diff --git a/pkgs/default.nix b/pkgs/default.nix new file mode 100644 index 0000000..def0aea --- /dev/null +++ b/pkgs/default.nix @@ -0,0 +1,14 @@ +{ self, ... }: { + systems = [ "x86_64-linux" ]; + + flake = { + overlays = rec { + packages = import ./packages.nix; + default = packages; + }; + }; + + perSystem = { pkgs, ... }: { + packages = self.overlays.default null pkgs; + }; +} diff --git a/overlays/packages.nix b/pkgs/packages.nix similarity index 85% rename from overlays/packages.nix rename to pkgs/packages.nix index cd4fe13..c77896d 100644 --- a/overlays/packages.nix +++ b/pkgs/packages.nix @@ -3,7 +3,6 @@ let call = prev.callPackage; in { customscripts = call ./customscripts { }; - mymacs = call ./emacs { }; tlauncher = call ./tlauncher { }; simp1e-cursors = call ./simp1e { }; } diff --git a/overlays/simp1e/default.nix b/pkgs/simp1e/default.nix similarity index 100% rename from overlays/simp1e/default.nix rename to pkgs/simp1e/default.nix diff --git a/overlays/tlauncher/default.nix b/pkgs/tlauncher/default.nix similarity index 100% rename from overlays/tlauncher/default.nix rename to pkgs/tlauncher/default.nix