mirror of
https://github.com/daylinmorgan/oizys.git
synced 2024-12-28 06:40:44 -06:00
Compare commits
5 commits
b33633cd3c
...
9b686cc202
Author | SHA1 | Date | |
---|---|---|---|
9b686cc202 | |||
00550108b1 | |||
13401e38f4 | |||
409fb6a016 | |||
92bc73b255 |
8 changed files with 71 additions and 125 deletions
30
flake.lock
30
flake.lock
|
@ -93,11 +93,11 @@
|
|||
"xdph": "xdph"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1710189206,
|
||||
"narHash": "sha256-BKD+JrinQN3V0Xf8Ft/P770shnUpxNRVjGKB0YU1OoI=",
|
||||
"lastModified": 1710344304,
|
||||
"narHash": "sha256-jE+/UGqRYkKBBpLTTV5ayCtVmD9N1WsSKpufszUPzcA=",
|
||||
"owner": "hyprwm",
|
||||
"repo": "Hyprland",
|
||||
"rev": "a065b481f32f4297596a9cd9c538794fd4669b1a",
|
||||
"rev": "3e67ee0f5f66c74c0a0bd4f797361fd100c2e2d2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -114,11 +114,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1709391291,
|
||||
"narHash": "sha256-NJwAgXRKLVuO3YLkGxXIanLvTKN+cJsYwbLoWOa7ODk=",
|
||||
"lastModified": 1710415616,
|
||||
"narHash": "sha256-1qVByzzCcKoCmP8ReUSAjKU5V9pfTLHQIM4WI1tvQ9E=",
|
||||
"owner": "hyprwm",
|
||||
"repo": "contrib",
|
||||
"rev": "2d4ece4a008feefddc194bde785b1d39f987b5a7",
|
||||
"rev": "75420d09f93346d9d23d5a1e26b42699f6b66cd6",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -285,11 +285,11 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1710313540,
|
||||
"narHash": "sha256-HtTTpGe0azsEJVaT9RvbGFGB4idUneraLiUTxFb3ABM=",
|
||||
"lastModified": 1710377395,
|
||||
"narHash": "sha256-KMubsUWtVr7L55pXMBibBDBdmk3xrjbBPduc0E8z28c=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "4008381882569ab4773f2ba0d7b7bbde8f665672",
|
||||
"rev": "db001797591bf76f7b8d4c4ed3b49233391e0c97",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -326,11 +326,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1710185740,
|
||||
"narHash": "sha256-MJtMIwXXIhIcIObEVb2VyKJNNmJM0qAMdS49K1PW2mE=",
|
||||
"lastModified": 1710422269,
|
||||
"narHash": "sha256-aZEM210J8gQ+nHCDXshM9pGwp6Wac51niM8ZdWJJFYQ=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs-wayland",
|
||||
"rev": "1ce086a5ec78554848ab094cc135eb6c26839642",
|
||||
"rev": "077f5833cb60efda5375053101b75150a5386e22",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -373,11 +373,11 @@
|
|||
},
|
||||
"stable": {
|
||||
"locked": {
|
||||
"lastModified": 1710021367,
|
||||
"narHash": "sha256-FuMVdWqXMT38u1lcySYyv93A7B8wU0EGzUr4t4jQu8g=",
|
||||
"lastModified": 1710283656,
|
||||
"narHash": "sha256-nI+AOy4uK6jLGBi9nsbHjL1EdSIzoo8oa+9oeVhbyFc=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "b94a96839afcc56de3551aa7472b8d9a3e77e05d",
|
||||
"rev": "51063ed4f2343a59fdeebb279bb81d87d453942b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
@ -2,7 +2,6 @@ final: prev: let
|
|||
inherit (final) hasSuffix;
|
||||
runes = import ../modules/runes;
|
||||
in {
|
||||
|
||||
isNixFile = path: hasSuffix ".nix" path;
|
||||
mkIfIn = name: list: prev.mkIf (builtins.elem name list);
|
||||
mkRune = {
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
qtile
|
||||
hyprland
|
||||
|
||||
|
||||
virtualbox
|
||||
|
||||
gui
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
}: let
|
||||
inherit (lib) mkIfIn;
|
||||
cfg = config.oizys.languages;
|
||||
pixi = pkgs.callPackage ../../pkgs/pixi.nix {};
|
||||
in {
|
||||
config = mkIfIn "python" cfg {
|
||||
environment.systemPackages = let
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
in {
|
||||
options.oizys.vbox.enable = mkEnableOption "enable virtualbox host";
|
||||
config = mkIf cfg.enable {
|
||||
virtualisation.virtualbox = {
|
||||
host.enable = true;
|
||||
};
|
||||
users.extraGroups.vboxusers.members = ["daylin"];
|
||||
virtualisation.virtualbox = {
|
||||
host.enable = true;
|
||||
};
|
||||
users.extraGroups.vboxusers.members = ["daylin"];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,23 +1,38 @@
|
|||
import std/[os, osproc, parseopt, times, strutils, terminal]
|
||||
import std/[macros, os, osproc, parseopt, times, strformat, strutils, terminal]
|
||||
from std/nativesockets import getHostname
|
||||
|
||||
let summaryFile = getEnv("GITHUB_STEP_SUMMARY")
|
||||
|
||||
proc info(args: varargs[string, `$`]) =
|
||||
macro doc(procedure: typed): untyped =
|
||||
## extract documenatation comments from procedure
|
||||
procedure.expectKind(nnkSym)
|
||||
if procedure.symKind != nskProc:
|
||||
error("procedure expected", procedure)
|
||||
let
|
||||
impl = procedure.getImpl
|
||||
docs = impl.body.extractDocCommentsAndRunnables
|
||||
var doc: string
|
||||
for element in docs:
|
||||
if element.kind == nnkCommentStmt:
|
||||
doc.addSep("\n", startLen = 1)
|
||||
doc.add($element)
|
||||
result = newLit(doc)
|
||||
|
||||
proc logInfo(args: varargs[string, `$`]) =
|
||||
stdout.styledWriteLine(
|
||||
fgCyan, "oizys", resetStyle, "|",
|
||||
styleDim, "INFO", resetStyle, "| ",
|
||||
args.join("")
|
||||
)
|
||||
|
||||
proc error(args: varargs[string, `$`]) =
|
||||
proc logErr(args: varargs[string, `$`]) =
|
||||
stdout.styledWriteLine(
|
||||
fgCyan, "oizys", resetStyle, "|",
|
||||
fgRed, "ERROR", resetStyle, "| ",
|
||||
args.join("")
|
||||
)
|
||||
|
||||
proc warn(args: varargs[string, `$`]) =
|
||||
proc logWarn(args: varargs[string, `$`]) =
|
||||
stdout.styledWriteLine(
|
||||
fgCyan, "oizys", resetStyle, "|",
|
||||
fgYellow, "WARN", resetStyle, "| ",
|
||||
|
@ -34,7 +49,7 @@ type
|
|||
|
||||
proc execQuit(c: OizysContext, args: varargs[string]) =
|
||||
let cmd = (@args & c.extraArgs).join(" ")
|
||||
info "exec: ", cmd
|
||||
logInfo "exec: ", cmd
|
||||
quit (execCmd cmd)
|
||||
|
||||
proc newCtx(): OizysContext =
|
||||
|
@ -44,11 +59,11 @@ proc newCtx(): OizysContext =
|
|||
|
||||
proc check(c: OizysContext) =
|
||||
if not dirExists c.flake:
|
||||
error c.flake, " does not exist"
|
||||
error "please use -f/--flake or $FLAKE_PATH"
|
||||
logErr c.flake, "does not exist"
|
||||
logErr "please use -f/--flake or $FLAKE_PATH"
|
||||
quit 1
|
||||
info "flake: ", c.flake
|
||||
info "host: ", c.host
|
||||
logInfo "flake:", c.flake
|
||||
logInfo "host:", c.host
|
||||
|
||||
proc cmd(c: OizysContext): string {.inline.} =
|
||||
let pixExists = findExe("pix") != ""
|
||||
|
@ -56,7 +71,7 @@ proc cmd(c: OizysContext): string {.inline.} =
|
|||
if pixExists:
|
||||
return "pix"
|
||||
else:
|
||||
warn "pinix not found, falling back to nix"
|
||||
logWarn "pinix not found, falling back to nix"
|
||||
return "nix"
|
||||
|
||||
proc systemFlakePath(c: OizysContext): string =
|
||||
|
@ -71,6 +86,7 @@ proc dry(c: OizysContext) =
|
|||
execQuit c, c.cmd, "build", c.systemFlakePath, "--dry-run"
|
||||
|
||||
proc cache(c: OizysContext) =
|
||||
## build and push to cachix
|
||||
let start = now()
|
||||
let code = execCmd """
|
||||
cachix watch-exec """ & c.cache & """ \
|
||||
|
@ -82,7 +98,7 @@ proc cache(c: OizysContext) =
|
|||
|
||||
let duration = (now() - start)
|
||||
if code != 0:
|
||||
error "failed to build configuration for: ", c.host
|
||||
logErr "failed to build configuration for: ", c.host
|
||||
quit code
|
||||
|
||||
if summaryFile != "":
|
||||
|
@ -90,7 +106,7 @@ proc cache(c: OizysContext) =
|
|||
summaryFile,
|
||||
"Built host: " & c.host & " in " & $duration & " seconds"
|
||||
)
|
||||
info "Built host: " & c.host & " in " & $duration & " seconds"
|
||||
logInfo "Built host: " & c.host & " in " & $duration & " seconds"
|
||||
|
||||
|
||||
proc nixosRebuild(c: OizysContext, subcmd: string) =
|
||||
|
@ -105,15 +121,20 @@ proc switch(c: OizysContext) =
|
|||
## nixos rebuild switch
|
||||
nixosRebuild c, "switch"
|
||||
|
||||
const usage = """
|
||||
proc path(c: OizysContext) =
|
||||
## print nix flake output
|
||||
echo c.systemFlakePath
|
||||
|
||||
const usage = fmt"""
|
||||
oizys <cmd> [opts]
|
||||
|
||||
commands:
|
||||
dry poor man's nix flake check
|
||||
boot nixos-rebuild boot
|
||||
switch nixos-rebuild switch
|
||||
cache build and push to cachix
|
||||
build build system flake
|
||||
dry {dry.doc}
|
||||
boot {boot.doc}
|
||||
switch {switch.doc}
|
||||
cache {cache.doc}
|
||||
build {build.doc}
|
||||
path {path.doc}
|
||||
|
||||
options:
|
||||
-h|--help show this help
|
||||
|
@ -131,8 +152,9 @@ proc runCmd(c: OizysContext, cmd: string) =
|
|||
of "boot": boot c
|
||||
of "cache": cache c
|
||||
of "build": build c
|
||||
of "path": path c
|
||||
else:
|
||||
error "unknown command: ", cmd
|
||||
logErr "unknown command: ", cmd
|
||||
echo usage
|
||||
quit 1
|
||||
|
||||
|
|
|
@ -10,13 +10,16 @@
|
|||
(f: f != "default.nix")
|
||||
(builtins.attrNames (builtins.readDir ./.)));
|
||||
in {
|
||||
nixpkgs.overlays = defaultOverlays ++ [
|
||||
(
|
||||
final: _prev: {
|
||||
stable = import inputs.stable { system = final.system;
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
nixpkgs.overlays =
|
||||
defaultOverlays
|
||||
++ [
|
||||
(
|
||||
final: _prev: {
|
||||
stable = import inputs.stable {
|
||||
system = final.system;
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
}
|
||||
)
|
||||
];
|
||||
)
|
||||
];
|
||||
}
|
||||
|
|
|
@ -1,76 +0,0 @@
|
|||
{ lib
|
||||
, stdenv
|
||||
, rustPlatform
|
||||
, fetchFromGitHub
|
||||
, pkg-config
|
||||
, openssl
|
||||
, installShellFiles
|
||||
, darwin
|
||||
, testers
|
||||
, pixi
|
||||
}:
|
||||
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "pixi";
|
||||
version = "0.15.2";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "prefix-dev";
|
||||
repo = "pixi";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-bh8Uu6Q2AND50Qzivc6k1Z8JWudkHC2i4YW1Hxa69SM=";
|
||||
};
|
||||
|
||||
cargoHash = "sha256-yMIcPwnuN7F2ZrOtJw8T+nxeSzLsYn+iC34bYeWpi/w=";
|
||||
|
||||
nativeBuildInputs = [
|
||||
pkg-config
|
||||
installShellFiles
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
openssl
|
||||
]
|
||||
++ lib.optionals stdenv.isDarwin (
|
||||
with darwin.apple_sdk_11_0.frameworks; [ CoreFoundation IOKit SystemConfiguration Security ]
|
||||
);
|
||||
|
||||
# There are some CI failures with Rattler. Tests on Aarch64 has been skipped.
|
||||
# See https://github.com/prefix-dev/pixi/pull/241.
|
||||
doCheck = !stdenv.isAarch64;
|
||||
|
||||
preCheck = ''
|
||||
export HOME="$(mktemp -d)"
|
||||
'';
|
||||
|
||||
checkFlags = [
|
||||
# Skip tests requiring network
|
||||
"--skip=add_channel"
|
||||
"--skip=add_functionality"
|
||||
"--skip=add_functionality_os"
|
||||
"--skip=add_functionality_union"
|
||||
"--skip=add_pypi_functionality"
|
||||
"--skip=test_alias"
|
||||
"--skip=test_cwd"
|
||||
"--skip=test_incremental_lock_file"
|
||||
];
|
||||
|
||||
postInstall = ''
|
||||
installShellCompletion --cmd pix \
|
||||
--bash <($out/bin/pixi completion --shell bash) \
|
||||
--fish <($out/bin/pixi completion --shell fish) \
|
||||
--zsh <($out/bin/pixi completion --shell zsh)
|
||||
'';
|
||||
|
||||
passthru.tests.version = testers.testVersion {
|
||||
package = pixi;
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
description = "Package management made easy";
|
||||
homepage = "https://pixi.sh/";
|
||||
license = licenses.bsd3;
|
||||
maintainers = with lib.maintainers; [ aaronjheng edmundmiller ];
|
||||
mainProgram = "pixi";
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue