cross-platform failing

pull/7/head
Pegasust 2023-01-19 07:28:54 -08:00
parent d4f6cf27a9
commit ca63340a3e
7 changed files with 109 additions and 98 deletions

View File

@ -117,11 +117,11 @@
"utils": "utils" "utils": "utils"
}, },
"locked": { "locked": {
"lastModified": 1673737886, "lastModified": 1673948101,
"narHash": "sha256-hNTqD0uIgpbtTI2Nuj/Q1lEFOOdZqqXpxoc8rMno2F0=", "narHash": "sha256-cD0OzFfnLFeeaz4jVszH9QiMTn+PBxmcYzrp+xujpwM=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "2827b5306462d91edec16a3d069b2d6e54c3079f", "rev": "bd3efacb82c721edad1ce9eda583df5fb62ab00a",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -156,11 +156,11 @@
}, },
"locked": { "locked": {
"dir": "contrib", "dir": "contrib",
"lastModified": 1673746461, "lastModified": 1673937267,
"narHash": "sha256-Y21pbVNlPWPokXFbngSahnxeCff0LX+LKdDktEBIVm4=", "narHash": "sha256-zixnItZtMZRKK0bEh8UOBeh8JT4jeMzPR2TtacfXmyE=",
"owner": "neovim", "owner": "neovim",
"repo": "neovim", "repo": "neovim",
"rev": "6134c1e8a39a5e61d0593613343a5923a86e3545", "rev": "2093e574c6c934a718f96d0a173aa965d3958a8b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -177,11 +177,11 @@
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
}, },
"locked": { "locked": {
"lastModified": 1673770422, "lastModified": 1673943288,
"narHash": "sha256-hYVEUzvqobxAM2FZfWTrTLKKNfkOSfsm0uGqNoSiIvw=", "narHash": "sha256-TDo9wDfZH+MJ/tTeCtZ67jdHqtVvIxetLpFN9+vqZ7g=",
"owner": "nix-community", "owner": "nix-community",
"repo": "neovim-nightly-overlay", "repo": "neovim-nightly-overlay",
"rev": "fd8e5953cfeada345d7daeedce6ab0919f1284d4", "rev": "3c0bb335936754a2683a84ddf081594ddb567a89",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -226,6 +226,21 @@
"type": "path" "type": "path"
} }
}, },
"nixlib": {
"locked": {
"lastModified": 1673743903,
"narHash": "sha256-sloY6KYyVOozJ1CkbgJPpZ99TKIjIvM+04V48C04sMQ=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "7555e2dfcbac1533f047021f1744ac8871150f9f",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1671983799, "lastModified": 1671983799,
@ -298,6 +313,7 @@
"neovim-nightly-overlay": "neovim-nightly-overlay", "neovim-nightly-overlay": "neovim-nightly-overlay",
"nix-index-database": "nix-index-database", "nix-index-database": "nix-index-database",
"nixgl": "nixgl", "nixgl": "nixgl",
"nixlib": "nixlib",
"nixpkgs": "nixpkgs_3", "nixpkgs": "nixpkgs_3",
"rust-overlay": "rust-overlay" "rust-overlay": "rust-overlay"
} }
@ -308,11 +324,11 @@
"nixpkgs": "nixpkgs_4" "nixpkgs": "nixpkgs_4"
}, },
"locked": { "locked": {
"lastModified": 1673749717, "lastModified": 1673922364,
"narHash": "sha256-hgrw8w/AThRWfVafx3EO3/TQlGcUou4nui8X47cVhXo=", "narHash": "sha256-U0XIY/Y/x4fFtlCZKMtWlqOYUnLiXj4F42GQHxWuPow=",
"owner": "oxalica", "owner": "oxalica",
"repo": "rust-overlay", "repo": "rust-overlay",
"rev": "aab6eb2dfc7a1e42d94b6f24ef13639ff8544af4", "rev": "4e0f9b8a5102387f8d19901bced16a256a6ccdc7",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -1,10 +1,15 @@
{ {
nixConfig = { nixConfig = {
accept-flake-config = true;
experimental-features = "nix-command flakes";
# for darwin's browser
allowUnsupportedSystem = true;
}; };
description = "My personal configuration in Nix (and some native configurations)"; description = "My personal configuration in Nix (and some native configurations)";
inputs = { inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable"; nixpkgs.url = "nixpkgs/nixos-unstable";
# continously merged & rebased lightweight .lib. Basically a huge extension to c_.
nixlib.url = "github:nix-community/nixpkgs.lib";
agenix = { agenix = {
url = "github:ryantm/agenix"; url = "github:ryantm/agenix";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
@ -45,8 +50,16 @@
, flake-compat , flake-compat
, neovim-nightly-overlay , neovim-nightly-overlay
, nix-index-database , nix-index-database
, nixlib
, ... , ...
}@_inputs: }@_inputs:
let
# config_fn:: system -> config
# this function should take simple exports of homeConfigurations.${profile},
# nixosConfigurations.${profile}, devShells.${profile}, packages.${profile}
# and correctly produce
cross_platform = config_fn: (config_fn "x86_64-linux");
in cross_platform (system:
let let
# Context/global stuffs to be passed down # Context/global stuffs to be passed down
# NOTE: this will only read files that are within git tree # NOTE: this will only read files that are within git tree
@ -65,17 +78,9 @@
hosts.path = "${path}/hosts"; hosts.path = "${path}/hosts";
users.path = "${path}/users"; users.path = "${path}/users";
}; };
# TODO: adapt to different platforms think about different systems later
system = "x86_64-linux";
overlays = [
rust-overlay.overlays.default
(self: pkgs@{ lib, ... }: {
lib = pkgs.lib // (import ./lib (_inputs // { inherit pkgs proj_root; }));
})
];
pkgs = import nixpkgs { pkgs = import nixpkgs {
inherit system; inherit system;
overlays = import ./overlays.nix _inputs; overlays = import ./overlays.nix (_inputs // {inherit system;});
config = { config = {
allowUnfree = true; allowUnfree = true;
}; };
@ -86,7 +91,7 @@
nixpkgs.lib nixpkgs.lib
pkgs.lib pkgs.lib
(import ./lib { (import ./lib {
inherit proj_root pkgs overlays system; inherit proj_root pkgs system;
inherit (pkgs) lib; inherit (pkgs) lib;
}) })
]); ]);
@ -121,7 +126,7 @@
inherit (hosts) nixosConfigurations; inherit (hosts) nixosConfigurations;
inherit (users) homeConfigurations; inherit (users) homeConfigurations;
inherit lib proj_root; inherit lib proj_root;
devShell."${system}" = import ./dev-shell.nix final_inputs; devShells = import ./dev-shell.nix final_inputs;
templates = import ./templates final_inputs; templates = import ./templates final_inputs;
secrets = { secrets = {
pubKeys = { pubKeys = {
@ -130,10 +135,10 @@
}; };
}; };
unit_tests = lib.runTests unit_tests; # unit_tests = lib.runTests unit_tests;
debug = { debug = {
inherit final_inputs hosts users modules lib inputs_w_lib unit_tests pkgs nixpkgs; inherit final_inputs hosts users modules lib inputs_w_lib unit_tests pkgs nixpkgs nixlib;
}; };
formatter."${system}" = pkgs.nixpkgs-fmt; formatter."${system}" = pkgs.nixpkgs-fmt;
}; });
} }

View File

@ -34,25 +34,6 @@
in in
"${mount_dest} ${confToBackendArg backend_args} :${s3fs-exec}\#${bucket}"; "${mount_dest} ${confToBackendArg backend_args} :${s3fs-exec}\#${bucket}";
personalStorage = [ personalStorage = [
# hungtr-hot @ phoenix is broken :)
# (autofs-s3fs_entry {
# mount_dest = "hot";
# backend_args = {
# "-fstype" = "fuse";
# use_cache = "/tmp";
# del_cache = null;
# allow_other = null;
# url = ''"https://f5i0.ph.idrivee2-32.com"'';
# # TODO: builtins.readFile requires a Git-controlled file
# passwd_file = config.age.secrets.s3fs.path;
# dbglevel = "debug"; # enable this for better debugging info in journalctl
# uid = "1000"; # default user
# gid = "100"; # users
# umask="003"; # others read only, fully shared for users group
# # _netdev = null; # ignored by s3fs (https://github.com/s3fs-fuse/s3fs-fuse/blob/master/src/s3fs.cpp#L4910)
# };
# bucket = "hungtr-hot";
# })
(autofs-s3fs_entry { (autofs-s3fs_entry {
mount_dest = "garden"; mount_dest = "garden";
backend_args = { backend_args = {

View File

@ -1,12 +1,11 @@
# We use top-level nix-flake, so default.nix is basically just a wrapper around ./flake.nix
(import (import
( (
# Get corresponding version of flake-compat declared in on ./flake.lock let
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in lock = builtins.fromJSON (builtins.readFile ./flake.lock);
fetchTarball { c_ = import ./../../c_.nix {src = ./.;};
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; in
sha256 = lock.nodes.flake-compat.locked.narHash; c_.fetchTree lock.nodes.flake-compat.locked
}
) )
{ src = ./.; } # calls flake.nix { src = ./.; }
).defaultNix ).defaultNix

View File

@ -97,11 +97,11 @@
"utils": "utils" "utils": "utils"
}, },
"locked": { "locked": {
"lastModified": 1673737886, "lastModified": 1673948101,
"narHash": "sha256-hNTqD0uIgpbtTI2Nuj/Q1lEFOOdZqqXpxoc8rMno2F0=", "narHash": "sha256-cD0OzFfnLFeeaz4jVszH9QiMTn+PBxmcYzrp+xujpwM=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "2827b5306462d91edec16a3d069b2d6e54c3079f", "rev": "bd3efacb82c721edad1ce9eda583df5fb62ab00a",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -136,11 +136,11 @@
}, },
"locked": { "locked": {
"dir": "contrib", "dir": "contrib",
"lastModified": 1673746461, "lastModified": 1673937267,
"narHash": "sha256-Y21pbVNlPWPokXFbngSahnxeCff0LX+LKdDktEBIVm4=", "narHash": "sha256-zixnItZtMZRKK0bEh8UOBeh8JT4jeMzPR2TtacfXmyE=",
"owner": "neovim", "owner": "neovim",
"repo": "neovim", "repo": "neovim",
"rev": "6134c1e8a39a5e61d0593613343a5923a86e3545", "rev": "2093e574c6c934a718f96d0a173aa965d3958a8b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -157,11 +157,11 @@
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
}, },
"locked": { "locked": {
"lastModified": 1673770422, "lastModified": 1673943288,
"narHash": "sha256-hYVEUzvqobxAM2FZfWTrTLKKNfkOSfsm0uGqNoSiIvw=", "narHash": "sha256-TDo9wDfZH+MJ/tTeCtZ67jdHqtVvIxetLpFN9+vqZ7g=",
"owner": "nix-community", "owner": "nix-community",
"repo": "neovim-nightly-overlay", "repo": "neovim-nightly-overlay",
"rev": "fd8e5953cfeada345d7daeedce6ab0919f1284d4", "rev": "3c0bb335936754a2683a84ddf081594ddb567a89",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -239,11 +239,11 @@
}, },
"nixpkgs_3": { "nixpkgs_3": {
"locked": { "locked": {
"lastModified": 1673631141, "lastModified": 1673796341,
"narHash": "sha256-AprpYQ5JvLS4wQG/ghm2UriZ9QZXvAwh1HlgA/6ZEVQ=", "narHash": "sha256-1kZi9OkukpNmOaPY7S5/+SlCDOuYnP3HkXHvNDyLQcc=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "befc83905c965adfd33e5cae49acb0351f6e0404", "rev": "6dccdc458512abce8d19f74195bb20fdb067df50",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -288,11 +288,11 @@
"nixpkgs": "nixpkgs_4" "nixpkgs": "nixpkgs_4"
}, },
"locked": { "locked": {
"lastModified": 1673749717, "lastModified": 1673922364,
"narHash": "sha256-hgrw8w/AThRWfVafx3EO3/TQlGcUou4nui8X47cVhXo=", "narHash": "sha256-U0XIY/Y/x4fFtlCZKMtWlqOYUnLiXj4F42GQHxWuPow=",
"owner": "oxalica", "owner": "oxalica",
"repo": "rust-overlay", "repo": "rust-overlay",
"rev": "aab6eb2dfc7a1e42d94b6f24ef13639ff8544af4", "rev": "4e0f9b8a5102387f8d19901bced16a256a6ccdc7",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -56,7 +56,7 @@
in in
cross_platform (system: cross_platform (system:
let let
overlays = import ./../../overlays.nix flake_inputs; overlays = import ./../../overlays.nix (flake_inputs // {inherit system;});
# pkgs = nixpkgs.legacyPackages.${system}.appendOverlays overlays; # pkgs = nixpkgs.legacyPackages.${system}.appendOverlays overlays;
pkgs = import nixpkgs { pkgs = import nixpkgs {
inherit system overlays; inherit system overlays;
@ -131,6 +131,7 @@
}; };
}; };
}; };
# Personal darwin, effectively serves as the Darwin edge channel
"hungtran" = home-manager.lib.homeManagerConfiguration { "hungtran" = home-manager.lib.homeManagerConfiguration {
inherit pkgs; inherit pkgs;
modules = base.modules ++ [ modules = base.modules ++ [
@ -140,10 +141,14 @@
# don't want to deal with GL stuffs on mac yet :/ # don't want to deal with GL stuffs on mac yet :/
base.graphics.useNixGL.defaultPackage = null; base.graphics.useNixGL.defaultPackage = null;
# NOTE: this actually does not exist # NOTE: this actually does not exist
base.keepass.path = "/Users/htran/keepass.kdbx"; base.keepass.path = "/Users/hungtran/keepass.kdbx";
base.alacritty.font.size = 11.0; base.alacritty.font.size = 11.0;
} }
nerd_font_module nerd_font_module
./base/productive_desktop.nix
{
base.private_chromium.enable = false;
}
]; ];
extraSpecialArgs = mkModuleArgs { extraSpecialArgs = mkModuleArgs {
inherit pkgs; inherit pkgs;
@ -153,6 +158,7 @@
}; };
}; };
}; };
# Work darwin
"htran" = home-manager.lib.homeManagerConfiguration { "htran" = home-manager.lib.homeManagerConfiguration {
inherit pkgs; inherit pkgs;
modules = base.modules ++ [ modules = base.modules ++ [

View File

@ -1,27 +1,14 @@
flake_input@{ kpcli-py, nixgl, rust-overlay, neovim-nightly-overlay, ... }: [ flake_input@{ kpcli-py
, nixgl
# TODO: this is quite harmful to add globally. nixGL is built not to be pure , rust-overlay
nixgl.overlays.default , neovim-nightly-overlay
, system
rust-overlay.overlays.default , ...
}: let
neovim-nightly-overlay.overlay kpcli-py = (final: prev: {
(final: prev:
let
nightlyRustWithExts = exts: final.rust-bin.selectLatestNightlyWith (
toolchain: (toolchain.minimal.override {
extensions = exts;
})
);
# https://rust-lang.github.io/rustup/concepts/profiles.html
rust-default-components = [ "rust-docs" "rustfmt" "clippy" ];
rust-dev-components = rust-default-components ++ [ "rust-src" "rust-analyzer" "miri" ];
in
{
# use python3.9, which works because of cython somehow? # use python3.9, which works because of cython somehow?
kpcli-py = final.poetry2nix.mkPoetryApplication { kpcli-py = final.poetry2nix.mkPoetryApplication {
projectDir = kpcli-py; projectDir = flake_input.kpcli-py;
python = final.python39; python = final.python39;
overrides = final.poetry2nix.defaultPoetryOverrides.extend (self: super: { overrides = final.poetry2nix.defaultPoetryOverrides.extend (self: super: {
# tableformatter requires setuptools # tableformatter requires setuptools
@ -32,11 +19,28 @@ flake_input@{ kpcli-py, nixgl, rust-overlay, neovim-nightly-overlay, ... }: [
); );
}); });
}; };
});
rust = (final: prev:
let
nightlyRustWithExts = exts: final.rust-bin.selectLatestNightlyWith (
toolchain: (toolchain.minimal.override {
extensions = exts;
})
);
# https://rust-lang.github.io/rustup/concepts/profiles.html
rust-default-components = [ "rust-docs" "rustfmt" "clippy" ];
rust-dev-components = rust-default-components ++ [ "rust-src" "rust-analyzer" "miri" ];
in {
rust4devs = nightlyRustWithExts rust-dev-components; rust4devs = nightlyRustWithExts rust-dev-components;
rust4cargo = nightlyRustWithExts [ ]; rust4cargo = nightlyRustWithExts [ ];
rust4normi = nightlyRustWithExts rust-default-components; rust4normi = nightlyRustWithExts rust-default-components;
}) });
in [
nixgl.overlays.default
rust-overlay.overlays.default
neovim-nightly-overlay.overlay
rust
kpcli-py
] ]