Skip to content

Commit

Permalink
Optimize NixOS-WSL
Browse files Browse the repository at this point in the history
  • Loading branch information
573 committed Nov 8, 2024
1 parent 6a97c37 commit c6defb5
Show file tree
Hide file tree
Showing 8 changed files with 712 additions and 613 deletions.
17 changes: 17 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

123 changes: 61 additions & 62 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
nixos-2211-small.url = "github:NixOS/nixpkgs/nixos-22.11-small";
nixos-2311.url = "github:NixOS/nixpkgs/nixos-23.11";

deploy-rs = {
deploy-rs = {
url = "github:serokell/deploy-rs";
inputs = {
flake-compat.follows = "flake-compat";
Expand Down Expand Up @@ -435,11 +435,10 @@ deploy-rs = {
};

outputs =
{
self,
nixpkgs,
nix-formatter-pack,
...
{ self
, nixpkgs
, nix-formatter-pack
, ...
}@inputs:
let
rootPath = self;
Expand Down Expand Up @@ -484,7 +483,7 @@ deploy-rs = {
{
inherit
inputs
rootPath # specialArgs
rootPath# specialArgs
forEachSystem
;
#inherit (nixpkgs.pkgs.stdenv.hostPlatform) system;
Expand Down Expand Up @@ -564,11 +563,11 @@ deploy-rs = {
});
in
{
/* deploy.nodes.sams9 = {
/* deploy.nodes.sams9 = {
hostname = "localhost";
profiles.system = {
user = "nix-on-droid";
sshUser = "nix-on-droid";
sshUser = "nix-on-droid";
path = inputs.deploy-rs.lib.x86_64-linux.activate.custom inputs.latest.legacyPackages.aarch64-linux.hello "./bin/hello";
};
}; */
Expand All @@ -581,7 +580,7 @@ deploy-rs = {

homeConfigurations = listToAttrs [
/**
calls `mkHome` as defined in ./flake/default.nix (`[system]` and `[name]` parameters) and ./flake/builders/mkHome.nix, latter the place where `extraSpecialArgs` would also go
calls `mkHome` as defined in ./flake/default.nix (`[system]` and `[name]` parameters) and ./flake/builders/mkHome.nix, latter the place where `extraSpecialArgs` would also go
*/
(mkHome "aarch64-linux" "u0_a210@localhost")
(mkHome "x86_64-linux" "dani@maiziedemacchiato")
Expand Down Expand Up @@ -660,26 +659,26 @@ deploy-rs = {
'';
path =
pkgs:
with pkgs;
(map (x: "${x.custom.programs.neovim.lightweight.outPath}") (
(
let
inherit (pkgs.stdenv) isLinux isx86_64;
in
lib.optionals (isLinux && isx86_64) [
self.nixosConfigurations.DANIELKNB1.config.home-manager.users.nixos
self.homeConfigurations."dani@maiziedemacchiato".config
]
)
++ (
let
inherit (pkgs.stdenv) isLinux isAarch64;
in
lib.optionals (isLinux && isAarch64) [
self.nixOnDroidConfigurations.sams9.config.home-manager.config
]
)
));
with pkgs;
(map (x: "${x.custom.programs.neovim.lightweight.outPath}") (
(
let
inherit (pkgs.stdenv) isLinux isx86_64;
in
lib.optionals (isLinux && isx86_64) [
self.nixosConfigurations.DANIELKNB1.config.home-manager.users.nixos
self.homeConfigurations."dani@maiziedemacchiato".config
]
)
++ (
let
inherit (pkgs.stdenv) isLinux isAarch64;
in
lib.optionals (isLinux && isAarch64) [
self.nixOnDroidConfigurations.sams9.config.home-manager.config
]
)
));
})

({
Expand All @@ -691,7 +690,7 @@ deploy-rs = {
{
program = builtins.toString (
pkgs.writeShellScript "testnixvim" ''
${self.inputs.nixvim.packages."${system}".default}/bin/nvim
${self.inputs.nixvim.packages."${system}".default}/bin/nvim
''
);
type = "app";
Expand All @@ -705,26 +704,26 @@ deploy-rs = {
'';
path =
pkgs:
with pkgs;
(map (x: "${x.custom.programs.emacs.finalPackage.outPath}") (
(
let
inherit (pkgs.stdenv) isLinux isx86_64;
in
lib.optionals (isLinux && isx86_64) [
self.nixosConfigurations.DANIELKNB1.config.home-manager.users.nixos
self.homeConfigurations."dani@maiziedemacchiato".config
]
)
++ (
let
inherit (pkgs.stdenv) isLinux isAarch64;
in
lib.optionals (isLinux && isAarch64) [
self.nixOnDroidConfigurations.sams9.config.home-manager.config
]
)
));
with pkgs;
(map (x: "${x.custom.programs.emacs.finalPackage.outPath}") (
(
let
inherit (pkgs.stdenv) isLinux isx86_64;
in
lib.optionals (isLinux && isx86_64) [
self.nixosConfigurations.DANIELKNB1.config.home-manager.users.nixos
self.homeConfigurations."dani@maiziedemacchiato".config
]
)
++ (
let
inherit (pkgs.stdenv) isLinux isAarch64;
in
lib.optionals (isLinux && isAarch64) [
self.nixOnDroidConfigurations.sams9.config.home-manager.config
]
)
));
})

(mkApp system "nixos-shell" {
Expand Down Expand Up @@ -769,9 +768,9 @@ deploy-rs = {
// {
nilApp = null;
}
#// {
#// {
# deploy-rs = inputs.deploy-rs.apps.${system}.default;
#}
#}
);

checks = forEachSystem (system: {
Expand All @@ -786,18 +785,18 @@ deploy-rs = {
buildInputs = [ pkgs.git self.nixosConfigurations.DANIELKNB1.pkgs.neovim ];
} ''
mkdir -p "$out"
mkdir -p "$out"
# prevent E886 ('/home-shelter' error)
export HOME=$TMPDIR
# presumes prior devenv shell run in ~/debugpy-devshell/, https://github.com/mfussenegger/nvim-dap-python/blob/408186a/README.md#debugpy
export VIRTUAL_ENV=/home/dkahlenberg/debugpy-devshell/.devenv/state/venv
nvim --headless +":scriptnames | q" 2> "$out/nvim.log"
export HOME=$TMPDIR
# presumes prior devenv shell run in ~/debugpy-devshell/, https://github.com/mfussenegger/nvim-dap-python/blob/408186a/README.md#debugpy
export VIRTUAL_ENV=/home/dkahlenberg/debugpy-devshell/.devenv/state/venv
nvim --headless +":scriptnames | q" 2> "$out/nvim.log"
if [ -n "$(cat "$out/nvim.log")" ]; then
echo "output: "$(cat "$out/nvim.log")""
exit 1
fi
echo "output: "$(cat "$out/nvim.log")""
exit 1
fi
'';
*/
});
Expand Down Expand Up @@ -876,7 +875,7 @@ deploy-rs = {
cljShell = inputs.clojure-dev-template.devShells.${system}.default;
ocamlShell = inputs.ocaml-dev-template.devShells.${system}.default;
nixdShell = inputs.nixd.devShells.${system}.default;
jupyShell = inputs.ml_env.devShells.${system}.default;
jupyShell = inputs.ml_env.devShells.${system}.default;
}
*/
);
Expand Down
8 changes: 4 additions & 4 deletions home/programs/helix.nix
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ in
name = "nix";
formatter.command = "nixfmt";
language-servers = [
language-server.nixd = with pkgs.nixd; [
command = "${nixd}/bin/nixd";
args = ["--inlay-hints" "--semantic-tokens"];
config.nixd.options.home-manager.expr = '(builtins.getFlake "${rootDir}").homeConfigurations.nix-on-droid.options';
# language-server.nixd = with pkgs.nixd; [
# command = "${nixd}/bin/nixd";
# args = ["--inlay-hints" "--semantic-tokens"];
# config.nixd.options.home-manager.expr = '(builtins.getFlake "${rootDir}").homeConfigurations.nix-on-droid.options';
];
}
{
Expand Down
Loading

0 comments on commit c6defb5

Please sign in to comment.