manage nix daemon by ourself
This commit is contained in:
parent
840f804b89
commit
873026fc91
4 changed files with 114 additions and 11 deletions
|
|
@ -15,6 +15,7 @@
|
|||
./jankyborders.nix
|
||||
./keyboard.nix
|
||||
./sketchybar
|
||||
./nix.nix
|
||||
];
|
||||
|
||||
options.custom = with lib; {
|
||||
|
|
|
|||
112
darwin/nix.nix
Normal file
112
darwin/nix.nix
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
{
|
||||
config,
|
||||
host,
|
||||
inputs,
|
||||
lib,
|
||||
pkgs,
|
||||
self,
|
||||
user,
|
||||
dots,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
environment = {
|
||||
# for nixlang / nixpkgs
|
||||
systemPackages = with pkgs; [
|
||||
nix-init
|
||||
nix-update
|
||||
nixfmt-rfc-style
|
||||
];
|
||||
};
|
||||
|
||||
custom.shell.packages = {
|
||||
# list all installed packages
|
||||
nix-list-packages = {
|
||||
text =
|
||||
let
|
||||
allPkgs = map (p: p.name) (
|
||||
config.environment.systemPackages ++ config.users.users.${user}.packages ++ config.hm.home.packages
|
||||
);
|
||||
in
|
||||
''sort -ui <<< "${lib.concatLines allPkgs}"'';
|
||||
};
|
||||
};
|
||||
|
||||
nix =
|
||||
let
|
||||
flakeInputs = lib.filterAttrs (_: lib.isType "flake") inputs;
|
||||
nixPath = lib.mapAttrsToList (n: _: "${n}=flake:${n}") flakeInputs;
|
||||
in
|
||||
{
|
||||
inherit nixPath;
|
||||
enable = true;
|
||||
channel.enable = false;
|
||||
optimise.automatic = true; # Optimise symlinks
|
||||
# required for nix-shell -p to work
|
||||
registry = lib.mapAttrs (_: flake: { inherit flake; }) flakeInputs;
|
||||
# gc = {
|
||||
# # Automatic garbage collection
|
||||
# automatic = true;
|
||||
# dates = "daily";
|
||||
# options = "--delete-older-than 7d";
|
||||
# };
|
||||
package = pkgs.nixVersions.latest;
|
||||
settings = {
|
||||
# re-evaluate on every rebuild instead of "cached failure of attribute" error
|
||||
# eval-cache = false;
|
||||
# required to be set, for some reason nix.nixPath does not write to nix.conf
|
||||
nix-path = nixPath;
|
||||
warn-dirty = false;
|
||||
# removes ~/.nix-profile and ~/.nix-defexpr
|
||||
use-xdg-base-directories = true;
|
||||
|
||||
# use flakes
|
||||
experimental-features = [
|
||||
"nix-command"
|
||||
"flakes"
|
||||
];
|
||||
substituters = [
|
||||
"https://nix-community.cachix.org"
|
||||
"https://ghostty.cachix.org"
|
||||
"https://rayandrew.cachix.org"
|
||||
"https://devenv.cachix.org"
|
||||
];
|
||||
# allow building and pushing of laptop config from desktop
|
||||
trusted-users = [ user ];
|
||||
trusted-public-keys = [
|
||||
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
||||
"ghostty.cachix.org-1:QB389yTa6gTyneehvqG58y0WnHjQOqgnA+wBnpWWxns="
|
||||
"rayandrew.cachix.org-1:kJnvdWgUyErPGaQWgh/yyu91szgRYD+V/WQ4Dbc4n9M="
|
||||
"devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw="
|
||||
];
|
||||
};
|
||||
# // lib.optionalAttrs (config.nix.package.pname == "lix") {
|
||||
# repl-overlays = [ ./repl-overlays.nix ];
|
||||
# };
|
||||
};
|
||||
|
||||
# add nixos-option workaround for flakes
|
||||
# https://github.com/NixOS/nixpkgs/issues/97855#issuecomment-1075818028
|
||||
nixpkgs.overlays = [
|
||||
(_: prev: {
|
||||
nixos-option =
|
||||
let
|
||||
flake-compat = prev.fetchFromGitHub {
|
||||
owner = "edolstra";
|
||||
repo = "flake-compat";
|
||||
rev = "12c64ca55c1014cdc1b16ed5a804aa8576601ff2";
|
||||
hash = "sha256-hY8g6H2KFL8ownSiFeMOjwPC8P0ueXpCVEbxgda3pko=";
|
||||
};
|
||||
prefix = ''(import ${flake-compat} { src = ${dots}; }).defaultNix.nixosConfigurations.${host}'';
|
||||
in
|
||||
prev.runCommandNoCC "nixos-option" { buildInputs = [ prev.makeWrapper ]; } ''
|
||||
makeWrapper ${lib.getExe prev.nixos-option} $out/bin/nixos-option \
|
||||
--add-flags --config_expr \
|
||||
--add-flags "\"${prefix}.config\"" \
|
||||
--add-flags --options_expr \
|
||||
--add-flags "\"${prefix}.options\""
|
||||
'';
|
||||
})
|
||||
];
|
||||
}
|
||||
|
|
@ -6,14 +6,6 @@ local utils = require("utils")
|
|||
local settings = require("settings")
|
||||
local app_icons = require("app_icons")
|
||||
|
||||
function parse_string_to_table(s)
|
||||
local result = {}
|
||||
for line in s:gmatch("([^\n]+)") do
|
||||
table.insert(result, line)
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
local function getAllWorkspaces()
|
||||
return utils.sbarExecP("aerospace list-workspaces --all --format '%{workspace}%{monitor-appkit-nsscreen-screens-id}%{monitor-id}%{monitor-name}' --json")
|
||||
end
|
||||
|
|
@ -100,7 +92,7 @@ function getState()
|
|||
else
|
||||
workspacestate["appicons"] = ""
|
||||
end
|
||||
print(utils.dump(workspacestate))
|
||||
-- print(utils.dump(workspacestate))
|
||||
end
|
||||
|
||||
return newstate
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@
|
|||
|
||||
nixpkgs.hostPlatform = system;
|
||||
|
||||
nix.enable = false;
|
||||
|
||||
users.users.${user} = {
|
||||
home = "/Users/${user}";
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue