sandbox to add fromYaml to a flake

nix-components
pegasust 2022-11-09 11:35:28 +00:00
parent 6a51c7cab7
commit c6de5f2e8b
7 changed files with 161 additions and 16 deletions

View File

@ -30,6 +30,21 @@
"type": "github"
}
},
"flake-utils_3": {
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
@ -101,12 +116,48 @@
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1665296151,
"narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "14ccaaedd95a488dd7ae142757884d8e125b3363",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"home-manager": "home-manager",
"nixgl": "nixgl",
"nixpkgs": "nixpkgs_2"
"nixpkgs": "nixpkgs_2",
"rust-overlay": "rust-overlay"
}
},
"rust-overlay": {
"inputs": {
"flake-utils": "flake-utils_3",
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1667943215,
"narHash": "sha256-FSD8RIL85Kbq3wVzxzYPuWkXtNaW/HldGpVVRDoPpnY=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "01a89f997e49dd624c7f94813feceda63e91ee2e",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"utils": {

View File

@ -8,14 +8,20 @@
};
flake-utils.url = "github:numtide/flake-utils";
nixgl.url = "github:guibou/nixGL";
rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs = { nixpkgs, home-manager, nixgl, ... }:
outputs = { nixpkgs, home-manager, nixgl, rust-overlay, flake-utils, ... }:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system}.appendOverlays [nixgl.overlay];
overlays = [ nixgl.overlay rust-overlay.overlays.default ];
# pkgs = nixpkgs.legacyPackages.${system}.appendOverlays overlays;
pkgs = import nixpkgs { inherit system overlays; };
lib = (import ../lib-nix { inherit pkgs; lib = pkgs.lib; });
in
{
rec {
inherit pkgs;
inherit lib;
homeConfigurations.nixos = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [
@ -25,6 +31,7 @@
# we migrate this from in-place modules to allow flexibility
# in this case, we can add "home" to input arglist of home.nix
extraSpecialArgs = {
inherit lib;
myHome = {
username = "nixos";
homeDirectory = "/home/nixos";
@ -37,6 +44,7 @@
./home.nix
];
extraSpecialArgs = {
# inherit lib;
myHome = {
username = "ubuntu_admin";
homeDirectory = "/home/ubuntu_admin";
@ -49,10 +57,11 @@
./home.nix
];
extraSpecialArgs = {
# inherit lib;
myHome = {
username = "hwtr";
homeDirectory = "/home/hwtr";
packages = [pkgs.nixgl.nixGLIntel];
packages = [ pkgs.nixgl.nixGLIntel ];
shellAliases = {
nixGL = "nixGLIntel";
};

View File

@ -0,0 +1,44 @@
{
"nodes": {
"from-yaml": {
"flake": false,
"locked": {
"lastModified": 1667993008,
"narHash": "sha256-X5RWyebq+j56mUGGCmZTVcJBy6Y/QgFEMHklaz+GOt0=",
"owner": "pegasust",
"repo": "fromYaml",
"rev": "23d2616051f5a781dcfe2915a526925fd9cdd08c",
"type": "github"
},
"original": {
"owner": "pegasust",
"repo": "fromYaml",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1667811565,
"narHash": "sha256-HYml7RdQPQ7X13VNe2CoDMqmifsXbt4ACTKxHRKQE3Q=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "667e5581d16745bcda791300ae7e2d73f49fff25",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"from-yaml": "from-yaml",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

View File

@ -0,0 +1,22 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
from-yaml ={
url = "github:pegasust/fromYaml";
flake = false;
};
};
outputs = {nixpkgs,from-yaml, ...}: let
system = "x86_64-linux";
pkgs = import nixpkgs {inherit system;};
lib = {
fromYaml = import "${from-yaml}/fromYaml.nix" {lib = pkgs.lib;};
};
in {
inherit nixpkgs;
inherit from-yaml;
inherit lib;
fromYamlFn = lib.fromYaml;
};
}

View File

@ -1,5 +1,10 @@
# myHome is injected from extraSpecialArgs in flake.nix
{ config, pkgs, myHome, ... }:
{ config
, pkgs
, myHome
# , lib
, ...
}:
{
home = {
username = myHome.username;
@ -7,12 +12,17 @@
stateVersion = myHome.stateVersion or "22.05";
};
home.packages = [
pkgs.htop pkgs.ripgrep pkgs.gcc pkgs.fd pkgs.zk pkgs.unzip
pkgs.rustc pkgs.cargo
pkgs.htop
pkgs.ripgrep
pkgs.gcc
pkgs.fd
pkgs.zk
pkgs.unzip
pkgs.rust-bin.nightly.latest.default
pkgs.nodejs-18_x
pkgs.rust-analyzer
pkgs.stdenv.cc.cc.lib
] ++ (myHome.packages or []);
] ++ (myHome.packages or [ ]);
nixpkgs.config.allowUnfree = true;
## Configs ##
@ -22,6 +32,7 @@
## Programs ##
programs.alacritty = myHome.programs.alacritty or {
enable = true;
# settings = lib.fromYaml builtins.readFile ../alacritty/alacritty.yml;
};
programs.direnv = {
enable = true;
@ -61,7 +72,7 @@
shellAliases = {
nix-rebuild = "sudo nixos-rebuild switch";
hm-switch = "home-manager switch --flake";
} // (myHome.shellAliases or {});
} // (myHome.shellAliases or { });
history = {
size = 10000;
path = "${config.xdg.dataHome}/zsh/history";
@ -75,13 +86,16 @@
enable = true;
lfs.enable = true;
aliases = {
a="add"; c="commit"; ca="commit --ammend"; cm="commit -m";
lol="log --graph --decorate --pretty=oneline --abbrev-commit";
lola="log --graph --decorate --pretty=oneline --abbrev-commit --all";
sts="status";
a = "add";
c = "commit";
ca = "commit --ammend";
cm = "commit -m";
lol = "log --graph --decorate --pretty=oneline --abbrev-commit";
lola = "log --graph --decorate --pretty=oneline --abbrev-commit --all";
sts = "status";
};
extraConfig = {
merge = {tool="vimdiff"; conflictstyle="diff3";};
merge = { tool = "vimdiff"; conflictstyle = "diff3"; };
};
# why is this no longer valid?
# pull = { rebase=true; };

4
lib-nix/default.nix Normal file
View File

@ -0,0 +1,4 @@
{pkgs, lib, ...}@flake_import:
{
fromYaml = import ./fromYaml/fromYaml.nix {inherit lib;};
}

1
lib-nix/fromYaml Submodule

@ -0,0 +1 @@
Subproject commit f31858f94e3f05d4982754eab0e1f427d1ca2497