refactor: fit structure of main directories
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2025-01-04 21:34:36 -05:00
parent 49dc072b81
commit d2625fa290
12 changed files with 110 additions and 99 deletions

View file

@ -1,14 +1,14 @@
# My NixOS configs # My NixOS configs
TODO: add directory structure info and enforce it TODO: add directory structure info and enforce it
- every root folder in the repo represents a flake output except inputs - [x] every root folder in the repo represents a flake output except inputs
- every root folder only has a `default.nix` and subfolders for each - [] every root folder only has an optional `default.nix` and subfolders for each
of its attrs of its attrs
- in a subfolder, there should always be a `default.nix` - [] in a subfolder, there should always be a `default.nix`
- if there is non nix code, it will be in a `config` folder - [] if there is non nix code, it will be in a `config` folder
- redo docs - [] redo docs
- every module should not do anything if imported - [] every module should not do anything if imported
- all nix files that represent a module should be `default.nix` (a nix file - [] 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`) which is imported directly can be called anything alongside `default.nix`)
## AGS ## AGS

View file

@ -22,7 +22,7 @@ in
prePatch = '' prePatch = ''
mv ./tsconfig.json ./project.json 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 ${jq}/bin/jq -sr '.[0] * .[1] | del(.extends)' ./project.json ./base.json > ./tsconfig.json
rm base.json project.json rm base.json project.json
''; '';

View file

@ -5,7 +5,7 @@
}: let }: let
inherit (pkgs.lib) getExe listToAttrs nameValuePair; 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: { mkApp = file: {
program = getExe (pkgs.callPackage file ({inherit buildApp;} // inputs)); program = getExe (pkgs.callPackage file ({inherit buildApp;} // inputs));

View file

@ -32,7 +32,7 @@
after = ["spotifyd.service"]; after = ["spotifyd.service"];
path = builtins.attrValues { path = builtins.attrValues {
inherit (pkgs) bluez; inherit (pkgs) bluez;
inherit (config.hardware.pulseaudio) package; inherit (config.services.pulseaudio) package;
}; };
script = '' script = ''
if [[ "$(pactl get-default-sink)" == "auto_null" ]]; then if [[ "$(pactl get-default-sink)" == "auto_null" ]]; then

View file

@ -5,7 +5,7 @@
}: let }: let
inherit (builtins) attrValues; inherit (builtins) attrValues;
langsShells = import ./langs.nix {inherit pkgs self;}; neovimShells = import ./neovim-shells {inherit pkgs self;};
bumpNpmDeps = pkgs.writeShellApplication { bumpNpmDeps = pkgs.writeShellApplication {
name = "bumpNpmDeps"; name = "bumpNpmDeps";
@ -24,91 +24,13 @@
}; };
in in
{ {
default = pkgs.mkShell { flake = pkgs.callPackage ./flake {};
packages = [ default = self.devShells.${pkgs.system}.flake;
(pkgs.writeShellApplication {
name = "mkIso";
runtimeInputs = attrValues { netdaemon = pkgs.callPackage ./netdaemon {};
inherit
(pkgs)
nix-output-monitor
;
};
text = '' node = pkgs.callPackage ./node {inherit bumpNpmDeps;};
isoConfig="nixosConfigurations.live-image.config.system.build.isoImage"
nom build "$FLAKE#$isoConfig"
'';
})
(pkgs.writeShellApplication { subtitles-dev = pkgs.callPackage ./subtitle-dev {inherit bumpNpmDeps;};
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
;
};
};
} }
// langsShells // neovimShells

View file

@ -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" {} +
'';
})
];
}

View file

@ -6,7 +6,7 @@
inherit (pkgs.lib) listToAttrs nameValuePair; inherit (pkgs.lib) listToAttrs nameValuePair;
mkLangsShells = langs: mkLangsShells = langs:
listToAttrs (map (l: 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); langs);
in in
mkLangsShells [ mkLangsShells [

View file

@ -0,0 +1,10 @@
{
mkShell,
dotnetCorePackages,
...
}:
mkShell {
packages = [
dotnetCorePackages.sdk_9_0
];
}

View file

@ -0,0 +1,14 @@
{
mkShell,
bumpNpmDeps,
nodejs_latest,
typescript,
...
}:
mkShell {
packages = [
bumpNpmDeps
nodejs_latest
typescript
];
}

View file

@ -0,0 +1,19 @@
{
mkShell,
bumpNpmDeps,
ffmpeg-full,
nodejs_latest,
nodePackages,
typescript,
...
}:
mkShell {
packages = [
nodejs_latest
typescript
ffmpeg-full
nodePackages.ts-node
bumpNpmDeps
];
}

View file

@ -137,7 +137,7 @@
appsPackages = appsPackages =
perSystem (pkgs: perSystem (pkgs:
import ./apps/nix/packages.nix {inherit pkgs self;}); import ./apps/packages.nix {inherit pkgs self;});
devShells = devShells =
perSystem (pkgs: perSystem (pkgs: