diff --git a/README.md b/README.md index 6cd0976b..71600ecf 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,15 @@ # My NixOS configs TODO: add directory structure info and enforce it - - every root folder in the repo represents a flake output except inputs - - every root folder only has a `default.nix` and subfolders for each - of its attrs - - in a subfolder, there should always be a `default.nix` - - if there is non nix code, it will be in a `config` folder - - redo docs - - every module should not do anything if imported - - all nix files that represent a module should be `default.nix` (a nix file - which is imported directly can be called anything alongside `default.nix`) + - [x] every root folder in the repo represents a flake output except inputs + - [] every root folder only has an optional `default.nix` and subfolders for each + of its attrs + - [] in a subfolder, there should always be a `default.nix` + - [] if there is non nix code, it will be in a `config` folder + - [] redo docs + - [] every module should not do anything if imported + - [] all nix files that represent a module should be `default.nix` (a nix file + which is imported directly can be called anything alongside `default.nix`) ## AGS diff --git a/apps/nix/buildApp.nix b/apps/buildApp.nix similarity index 92% rename from apps/nix/buildApp.nix rename to apps/buildApp.nix index a9689893..8b8c274d 100644 --- a/apps/nix/buildApp.nix +++ b/apps/buildApp.nix @@ -22,7 +22,7 @@ in prePatch = '' mv ./tsconfig.json ./project.json - sed 's/^ *\/\/.*//' ${../config/tsconfig.json} > ./base.json + sed 's/^ *\/\/.*//' ${./config/tsconfig.json} > ./base.json ${jq}/bin/jq -sr '.[0] * .[1] | del(.extends)' ./project.json ./base.json > ./tsconfig.json rm base.json project.json ''; diff --git a/apps/default.nix b/apps/default.nix index 5d039cfc..c514fa0f 100644 --- a/apps/default.nix +++ b/apps/default.nix @@ -5,7 +5,7 @@ }: let inherit (pkgs.lib) getExe listToAttrs nameValuePair; - buildApp = attrs: (pkgs.callPackage ./nix/buildApp.nix ({} // inputs // attrs)); + buildApp = attrs: (pkgs.callPackage ./buildApp.nix ({} // inputs // attrs)); mkApp = file: { program = getExe (pkgs.callPackage file ({inherit buildApp;} // inputs)); diff --git a/apps/nix/packages.nix b/apps/packages.nix similarity index 100% rename from apps/nix/packages.nix rename to apps/packages.nix diff --git a/configurations/homie/modules/music/default.nix b/configurations/homie/modules/music/default.nix index 8f376227..1e854a68 100644 --- a/configurations/homie/modules/music/default.nix +++ b/configurations/homie/modules/music/default.nix @@ -32,7 +32,7 @@ after = ["spotifyd.service"]; path = builtins.attrValues { inherit (pkgs) bluez; - inherit (config.hardware.pulseaudio) package; + inherit (config.services.pulseaudio) package; }; script = '' if [[ "$(pactl get-default-sink)" == "auto_null" ]]; then diff --git a/devShells/default.nix b/devShells/default.nix index 39585db3..760e3e0a 100644 --- a/devShells/default.nix +++ b/devShells/default.nix @@ -5,7 +5,7 @@ }: let inherit (builtins) attrValues; - langsShells = import ./langs.nix {inherit pkgs self;}; + neovimShells = import ./neovim-shells {inherit pkgs self;}; bumpNpmDeps = pkgs.writeShellApplication { name = "bumpNpmDeps"; @@ -24,91 +24,13 @@ }; in { - default = pkgs.mkShell { - packages = [ - (pkgs.writeShellApplication { - name = "mkIso"; + flake = pkgs.callPackage ./flake {}; + default = self.devShells.${pkgs.system}.flake; - runtimeInputs = attrValues { - inherit - (pkgs) - nix-output-monitor - ; - }; + netdaemon = pkgs.callPackage ./netdaemon {}; - text = '' - isoConfig="nixosConfigurations.live-image.config.system.build.isoImage" - nom build "$FLAKE#$isoConfig" - ''; - }) + node = pkgs.callPackage ./node {inherit bumpNpmDeps;}; - (pkgs.writeShellApplication { - name = "fixUidChange"; - - runtimeInputs = attrValues { - inherit - (pkgs) - findutils - gnused - ; - }; - - text = '' - GROUP="$1" - OLD_GID="$2" - NEW_GID="$3" - - # Remove generated group entry - sudo sed -i -e "/^$GROUP:/d" /etc/group - - # Change GID on existing files - sudo find / -gid "$OLD_GID" -exec chgrp "$NEW_GID" {} + - ''; - }) - ]; - }; - - netdaemon = pkgs.mkShell { - packages = attrValues { - inherit - (pkgs.dotnetCorePackages) - sdk_9_0 - ; - }; - }; - - node = pkgs.mkShell { - packages = attrValues { - inherit - (pkgs) - nodejs_latest - typescript - ; - - inherit - bumpNpmDeps - ; - }; - }; - - subtitles-dev = pkgs.mkShell { - packages = attrValues { - inherit - (pkgs) - nodejs_latest - typescript - ffmpeg-full - ; - - inherit - (pkgs.nodePackages) - ts-node - ; - - inherit - bumpNpmDeps - ; - }; - }; + subtitles-dev = pkgs.callPackage ./subtitle-dev {inherit bumpNpmDeps;}; } - // langsShells + // neovimShells diff --git a/devShells/flake/default.nix b/devShells/flake/default.nix new file mode 100644 index 00000000..56336eb4 --- /dev/null +++ b/devShells/flake/default.nix @@ -0,0 +1,46 @@ +{ + mkShell, + writeShellApplication, + # deps + findutils, + gnused, + nix-output-monitor, + ... +}: +mkShell { + packages = [ + (writeShellApplication { + name = "mkIso"; + + runtimeInputs = [ + nix-output-monitor + ]; + + text = '' + isoConfig="nixosConfigurations.live-image.config.system.build.isoImage" + nom build "$FLAKE#$isoConfig" + ''; + }) + + (writeShellApplication { + name = "fixUidChange"; + + runtimeInputs = [ + findutils + gnused + ]; + + text = '' + GROUP="$1" + OLD_GID="$2" + NEW_GID="$3" + + # Remove generated group entry + sudo sed -i -e "/^$GROUP:/d" /etc/group + + # Change GID on existing files + sudo find / -gid "$OLD_GID" -exec chgrp "$NEW_GID" {} + + ''; + }) + ]; +} diff --git a/devShells/langs.nix b/devShells/neovim-shells/default.nix similarity index 68% rename from devShells/langs.nix rename to devShells/neovim-shells/default.nix index eed5cd7a..e55e44ea 100644 --- a/devShells/langs.nix +++ b/devShells/neovim-shells/default.nix @@ -6,7 +6,7 @@ inherit (pkgs.lib) listToAttrs nameValuePair; mkLangsShells = langs: listToAttrs (map (l: - nameValuePair l (pkgs.callPackage ../homeManagerModules/neovim/langs/${l}/shell.nix {inherit self;})) + nameValuePair l (pkgs.callPackage "${self}/homeManagerModules/neovim/langs/${l}/shell.nix" {inherit self;})) langs); in mkLangsShells [ diff --git a/devShells/netdaemon/default.nix b/devShells/netdaemon/default.nix new file mode 100644 index 00000000..7575abfa --- /dev/null +++ b/devShells/netdaemon/default.nix @@ -0,0 +1,10 @@ +{ + mkShell, + dotnetCorePackages, + ... +}: +mkShell { + packages = [ + dotnetCorePackages.sdk_9_0 + ]; +} diff --git a/devShells/node/default.nix b/devShells/node/default.nix new file mode 100644 index 00000000..5a3e705a --- /dev/null +++ b/devShells/node/default.nix @@ -0,0 +1,14 @@ +{ + mkShell, + bumpNpmDeps, + nodejs_latest, + typescript, + ... +}: +mkShell { + packages = [ + bumpNpmDeps + nodejs_latest + typescript + ]; +} diff --git a/devShells/subtitle-dev/default.nix b/devShells/subtitle-dev/default.nix new file mode 100644 index 00000000..3365ba8c --- /dev/null +++ b/devShells/subtitle-dev/default.nix @@ -0,0 +1,19 @@ +{ + mkShell, + bumpNpmDeps, + ffmpeg-full, + nodejs_latest, + nodePackages, + typescript, + ... +}: +mkShell { + packages = [ + nodejs_latest + typescript + ffmpeg-full + nodePackages.ts-node + + bumpNpmDeps + ]; +} diff --git a/outputs.nix b/outputs.nix index 257d6a7f..448c04f6 100644 --- a/outputs.nix +++ b/outputs.nix @@ -137,7 +137,7 @@ appsPackages = perSystem (pkgs: - import ./apps/nix/packages.nix {inherit pkgs self;}); + import ./apps/packages.nix {inherit pkgs self;}); devShells = perSystem (pkgs: