mirror of
https://github.com/daylinmorgan/oizys.git
synced 2024-12-29 11:30:43 -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"
|
"xdph": "xdph"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1710189206,
|
"lastModified": 1710344304,
|
||||||
"narHash": "sha256-BKD+JrinQN3V0Xf8Ft/P770shnUpxNRVjGKB0YU1OoI=",
|
"narHash": "sha256-jE+/UGqRYkKBBpLTTV5ayCtVmD9N1WsSKpufszUPzcA=",
|
||||||
"owner": "hyprwm",
|
"owner": "hyprwm",
|
||||||
"repo": "Hyprland",
|
"repo": "Hyprland",
|
||||||
"rev": "a065b481f32f4297596a9cd9c538794fd4669b1a",
|
"rev": "3e67ee0f5f66c74c0a0bd4f797361fd100c2e2d2",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -114,11 +114,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1709391291,
|
"lastModified": 1710415616,
|
||||||
"narHash": "sha256-NJwAgXRKLVuO3YLkGxXIanLvTKN+cJsYwbLoWOa7ODk=",
|
"narHash": "sha256-1qVByzzCcKoCmP8ReUSAjKU5V9pfTLHQIM4WI1tvQ9E=",
|
||||||
"owner": "hyprwm",
|
"owner": "hyprwm",
|
||||||
"repo": "contrib",
|
"repo": "contrib",
|
||||||
"rev": "2d4ece4a008feefddc194bde785b1d39f987b5a7",
|
"rev": "75420d09f93346d9d23d5a1e26b42699f6b66cd6",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -285,11 +285,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1710313540,
|
"lastModified": 1710377395,
|
||||||
"narHash": "sha256-HtTTpGe0azsEJVaT9RvbGFGB4idUneraLiUTxFb3ABM=",
|
"narHash": "sha256-KMubsUWtVr7L55pXMBibBDBdmk3xrjbBPduc0E8z28c=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "4008381882569ab4773f2ba0d7b7bbde8f665672",
|
"rev": "db001797591bf76f7b8d4c4ed3b49233391e0c97",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -326,11 +326,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1710185740,
|
"lastModified": 1710422269,
|
||||||
"narHash": "sha256-MJtMIwXXIhIcIObEVb2VyKJNNmJM0qAMdS49K1PW2mE=",
|
"narHash": "sha256-aZEM210J8gQ+nHCDXshM9pGwp6Wac51niM8ZdWJJFYQ=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "nixpkgs-wayland",
|
"repo": "nixpkgs-wayland",
|
||||||
"rev": "1ce086a5ec78554848ab094cc135eb6c26839642",
|
"rev": "077f5833cb60efda5375053101b75150a5386e22",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -373,11 +373,11 @@
|
||||||
},
|
},
|
||||||
"stable": {
|
"stable": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1710021367,
|
"lastModified": 1710283656,
|
||||||
"narHash": "sha256-FuMVdWqXMT38u1lcySYyv93A7B8wU0EGzUr4t4jQu8g=",
|
"narHash": "sha256-nI+AOy4uK6jLGBi9nsbHjL1EdSIzoo8oa+9oeVhbyFc=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "b94a96839afcc56de3551aa7472b8d9a3e77e05d",
|
"rev": "51063ed4f2343a59fdeebb279bb81d87d453942b",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -2,7 +2,6 @@ final: prev: let
|
||||||
inherit (final) hasSuffix;
|
inherit (final) hasSuffix;
|
||||||
runes = import ../modules/runes;
|
runes = import ../modules/runes;
|
||||||
in {
|
in {
|
||||||
|
|
||||||
isNixFile = path: hasSuffix ".nix" path;
|
isNixFile = path: hasSuffix ".nix" path;
|
||||||
mkIfIn = name: list: prev.mkIf (builtins.elem name list);
|
mkIfIn = name: list: prev.mkIf (builtins.elem name list);
|
||||||
mkRune = {
|
mkRune = {
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
qtile
|
qtile
|
||||||
hyprland
|
hyprland
|
||||||
|
|
||||||
|
|
||||||
virtualbox
|
virtualbox
|
||||||
|
|
||||||
gui
|
gui
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (lib) mkIfIn;
|
inherit (lib) mkIfIn;
|
||||||
cfg = config.oizys.languages;
|
cfg = config.oizys.languages;
|
||||||
pixi = pkgs.callPackage ../../pkgs/pixi.nix {};
|
|
||||||
in {
|
in {
|
||||||
config = mkIfIn "python" cfg {
|
config = mkIfIn "python" cfg {
|
||||||
environment.systemPackages = let
|
environment.systemPackages = let
|
||||||
|
|
|
@ -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
|
from std/nativesockets import getHostname
|
||||||
|
|
||||||
let summaryFile = getEnv("GITHUB_STEP_SUMMARY")
|
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(
|
stdout.styledWriteLine(
|
||||||
fgCyan, "oizys", resetStyle, "|",
|
fgCyan, "oizys", resetStyle, "|",
|
||||||
styleDim, "INFO", resetStyle, "| ",
|
styleDim, "INFO", resetStyle, "| ",
|
||||||
args.join("")
|
args.join("")
|
||||||
)
|
)
|
||||||
|
|
||||||
proc error(args: varargs[string, `$`]) =
|
proc logErr(args: varargs[string, `$`]) =
|
||||||
stdout.styledWriteLine(
|
stdout.styledWriteLine(
|
||||||
fgCyan, "oizys", resetStyle, "|",
|
fgCyan, "oizys", resetStyle, "|",
|
||||||
fgRed, "ERROR", resetStyle, "| ",
|
fgRed, "ERROR", resetStyle, "| ",
|
||||||
args.join("")
|
args.join("")
|
||||||
)
|
)
|
||||||
|
|
||||||
proc warn(args: varargs[string, `$`]) =
|
proc logWarn(args: varargs[string, `$`]) =
|
||||||
stdout.styledWriteLine(
|
stdout.styledWriteLine(
|
||||||
fgCyan, "oizys", resetStyle, "|",
|
fgCyan, "oizys", resetStyle, "|",
|
||||||
fgYellow, "WARN", resetStyle, "| ",
|
fgYellow, "WARN", resetStyle, "| ",
|
||||||
|
@ -34,7 +49,7 @@ type
|
||||||
|
|
||||||
proc execQuit(c: OizysContext, args: varargs[string]) =
|
proc execQuit(c: OizysContext, args: varargs[string]) =
|
||||||
let cmd = (@args & c.extraArgs).join(" ")
|
let cmd = (@args & c.extraArgs).join(" ")
|
||||||
info "exec: ", cmd
|
logInfo "exec: ", cmd
|
||||||
quit (execCmd cmd)
|
quit (execCmd cmd)
|
||||||
|
|
||||||
proc newCtx(): OizysContext =
|
proc newCtx(): OizysContext =
|
||||||
|
@ -44,11 +59,11 @@ proc newCtx(): OizysContext =
|
||||||
|
|
||||||
proc check(c: OizysContext) =
|
proc check(c: OizysContext) =
|
||||||
if not dirExists c.flake:
|
if not dirExists c.flake:
|
||||||
error c.flake, " does not exist"
|
logErr c.flake, "does not exist"
|
||||||
error "please use -f/--flake or $FLAKE_PATH"
|
logErr "please use -f/--flake or $FLAKE_PATH"
|
||||||
quit 1
|
quit 1
|
||||||
info "flake: ", c.flake
|
logInfo "flake:", c.flake
|
||||||
info "host: ", c.host
|
logInfo "host:", c.host
|
||||||
|
|
||||||
proc cmd(c: OizysContext): string {.inline.} =
|
proc cmd(c: OizysContext): string {.inline.} =
|
||||||
let pixExists = findExe("pix") != ""
|
let pixExists = findExe("pix") != ""
|
||||||
|
@ -56,7 +71,7 @@ proc cmd(c: OizysContext): string {.inline.} =
|
||||||
if pixExists:
|
if pixExists:
|
||||||
return "pix"
|
return "pix"
|
||||||
else:
|
else:
|
||||||
warn "pinix not found, falling back to nix"
|
logWarn "pinix not found, falling back to nix"
|
||||||
return "nix"
|
return "nix"
|
||||||
|
|
||||||
proc systemFlakePath(c: OizysContext): string =
|
proc systemFlakePath(c: OizysContext): string =
|
||||||
|
@ -71,6 +86,7 @@ proc dry(c: OizysContext) =
|
||||||
execQuit c, c.cmd, "build", c.systemFlakePath, "--dry-run"
|
execQuit c, c.cmd, "build", c.systemFlakePath, "--dry-run"
|
||||||
|
|
||||||
proc cache(c: OizysContext) =
|
proc cache(c: OizysContext) =
|
||||||
|
## build and push to cachix
|
||||||
let start = now()
|
let start = now()
|
||||||
let code = execCmd """
|
let code = execCmd """
|
||||||
cachix watch-exec """ & c.cache & """ \
|
cachix watch-exec """ & c.cache & """ \
|
||||||
|
@ -82,7 +98,7 @@ proc cache(c: OizysContext) =
|
||||||
|
|
||||||
let duration = (now() - start)
|
let duration = (now() - start)
|
||||||
if code != 0:
|
if code != 0:
|
||||||
error "failed to build configuration for: ", c.host
|
logErr "failed to build configuration for: ", c.host
|
||||||
quit code
|
quit code
|
||||||
|
|
||||||
if summaryFile != "":
|
if summaryFile != "":
|
||||||
|
@ -90,7 +106,7 @@ proc cache(c: OizysContext) =
|
||||||
summaryFile,
|
summaryFile,
|
||||||
"Built host: " & c.host & " in " & $duration & " seconds"
|
"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) =
|
proc nixosRebuild(c: OizysContext, subcmd: string) =
|
||||||
|
@ -105,15 +121,20 @@ proc switch(c: OizysContext) =
|
||||||
## nixos rebuild switch
|
## nixos rebuild switch
|
||||||
nixosRebuild c, "switch"
|
nixosRebuild c, "switch"
|
||||||
|
|
||||||
const usage = """
|
proc path(c: OizysContext) =
|
||||||
|
## print nix flake output
|
||||||
|
echo c.systemFlakePath
|
||||||
|
|
||||||
|
const usage = fmt"""
|
||||||
oizys <cmd> [opts]
|
oizys <cmd> [opts]
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
dry poor man's nix flake check
|
dry {dry.doc}
|
||||||
boot nixos-rebuild boot
|
boot {boot.doc}
|
||||||
switch nixos-rebuild switch
|
switch {switch.doc}
|
||||||
cache build and push to cachix
|
cache {cache.doc}
|
||||||
build build system flake
|
build {build.doc}
|
||||||
|
path {path.doc}
|
||||||
|
|
||||||
options:
|
options:
|
||||||
-h|--help show this help
|
-h|--help show this help
|
||||||
|
@ -131,8 +152,9 @@ proc runCmd(c: OizysContext, cmd: string) =
|
||||||
of "boot": boot c
|
of "boot": boot c
|
||||||
of "cache": cache c
|
of "cache": cache c
|
||||||
of "build": build c
|
of "build": build c
|
||||||
|
of "path": path c
|
||||||
else:
|
else:
|
||||||
error "unknown command: ", cmd
|
logErr "unknown command: ", cmd
|
||||||
echo usage
|
echo usage
|
||||||
quit 1
|
quit 1
|
||||||
|
|
||||||
|
|
|
@ -10,10 +10,13 @@
|
||||||
(f: f != "default.nix")
|
(f: f != "default.nix")
|
||||||
(builtins.attrNames (builtins.readDir ./.)));
|
(builtins.attrNames (builtins.readDir ./.)));
|
||||||
in {
|
in {
|
||||||
nixpkgs.overlays = defaultOverlays ++ [
|
nixpkgs.overlays =
|
||||||
|
defaultOverlays
|
||||||
|
++ [
|
||||||
(
|
(
|
||||||
final: _prev: {
|
final: _prev: {
|
||||||
stable = import inputs.stable { system = final.system;
|
stable = import inputs.stable {
|
||||||
|
system = final.system;
|
||||||
config.allowUnfree = true;
|
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