Build with nix properly
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,5 +1,5 @@
|
|||||||
/.direnv/
|
/.direnv/
|
||||||
/.jpm/
|
/.jpm/
|
||||||
/build/
|
/build/
|
||||||
/result/
|
/result
|
||||||
/_build/
|
/_build/
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
@{:name "censtablo" :description "River Window Manager" :jpm-dependencies @["https://codeberg.org/ifreund/janet-wayland" "https://codeberg.org/ifreund/janet-xkbcommon"]}
|
@{:name "censtablo" :description "River Window Manager"}
|
||||||
|
|||||||
200
flake.nix
200
flake.nix
@@ -5,7 +5,7 @@
|
|||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = {
|
outputs = inputs @ {
|
||||||
self,
|
self,
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
river,
|
river,
|
||||||
@@ -16,85 +16,70 @@
|
|||||||
f {
|
f {
|
||||||
inherit system;
|
inherit system;
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
|
ownPkgs = self.packages.${system};
|
||||||
});
|
});
|
||||||
in {
|
in {
|
||||||
devShells = eachSystem ({
|
packages = eachSystem ({
|
||||||
pkgs,
|
pkgs,
|
||||||
system,
|
system,
|
||||||
...
|
...
|
||||||
}: {
|
}: let
|
||||||
default = pkgs.mkShell (let
|
libxkbcommon = pkgs.libxkbcommon.overrideAttrs {
|
||||||
libxkbcommon = pkgs.libxkbcommon.overrideAttrs {
|
version = "1.12.0";
|
||||||
version = "1.12.0";
|
src = pkgs.fetchFromGitHub {
|
||||||
src = pkgs.fetchFromGitHub {
|
owner = "xkbcommon";
|
||||||
owner = "xkbcommon";
|
repo = "libxkbcommon";
|
||||||
repo = "libxkbcommon";
|
tag = "xkbcommon-1.12.0";
|
||||||
tag = "xkbcommon-1.12.0";
|
hash = "sha256-QO3snl7NiyS2ao2MF3eT/lkNmVBjijr3JdTyrPn/2MQ=";
|
||||||
hash = "sha256-QO3snl7NiyS2ao2MF3eT/lkNmVBjijr3JdTyrPn/2MQ=";
|
|
||||||
};
|
|
||||||
patches = [];
|
|
||||||
doCheck = false;
|
|
||||||
};
|
};
|
||||||
in {
|
patches = [];
|
||||||
packages = let
|
doCheck = false;
|
||||||
janet-pm = pkgs.stdenv.mkDerivation rec {
|
};
|
||||||
pname = "janet-pm";
|
spork = pkgs.fetchFromGitHub {
|
||||||
version = "1.1.1";
|
owner = "janet-lang";
|
||||||
src = pkgs.fetchFromGitHub {
|
repo = "spork";
|
||||||
owner = "janet-lang";
|
rev = "master";
|
||||||
repo = "spork";
|
hash = "sha256-gFUyrqkcjD34LZ9G7igaDwHnfIUUN9MzbvwEk9uWl1w=";
|
||||||
rev = "v${version}";
|
};
|
||||||
hash = "sha256-0L2G7flzNzi8w1nkGcQrtKjGl/D2uC8xSRgsBuLgRxM=";
|
janet-pm = pkgs.stdenv.mkDerivation {
|
||||||
};
|
pname = "janet-pm";
|
||||||
patches = [
|
version = "1.1.1";
|
||||||
(pkgs.fetchpatch {
|
src = spork;
|
||||||
url = "https://github.com/tw4452852/spork/commit/304ff781565d9bac21bef450770a312182730727.patch";
|
buildInputs = [pkgs.janet];
|
||||||
hash = "sha256-9hTY3s3GphAg07we7gOF8vAPAYaWOjVkaspt8wP5KOU=";
|
|
||||||
})
|
|
||||||
(pkgs.fetchpatch {
|
|
||||||
url = "https://patch-diff.githubusercontent.com/raw/janet-lang/spork/pull/269.patch";
|
|
||||||
hash = "sha256-HMvqmiZR+a2yE54PqlLji2Vi6zoUcQ8eD5HFcqAPxEo=";
|
|
||||||
})
|
|
||||||
];
|
|
||||||
nativeBuildInputs = [pkgs.janet];
|
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
export JANET_PATH=$out
|
export JANET_PATH=$out
|
||||||
mkdir $JANET_PATH
|
mkdir $JANET_PATH
|
||||||
janet --install .
|
janet --install .
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
river-pkg = pkgs.stdenv.mkDerivation (finalAttrs: {
|
river = pkgs.stdenv.mkDerivation (finalAttrs: {
|
||||||
name = "river";
|
name = "river";
|
||||||
version = "0.4";
|
version = "0.4";
|
||||||
src = river;
|
src = inputs.river;
|
||||||
deps = pkgs.callPackage ./river.build.zig.zon.nix {};
|
deps = pkgs.callPackage ./river.build.zig.zon.nix {};
|
||||||
zigBuildFlags = ["--system" "${finalAttrs.deps}" "-Dxwayland"];
|
zigBuildFlags = ["--system" "${finalAttrs.deps}" "-Dxwayland"];
|
||||||
nativeBuildInputs = with pkgs; [pkg-config wayland-scanner xwayland zig_0_15.hook];
|
nativeBuildInputs = with pkgs; [pkg-config wayland-scanner xwayland zig_0_15.hook];
|
||||||
buildInputs = with pkgs; [
|
buildInputs = with pkgs; [
|
||||||
libGL
|
libGL
|
||||||
libevdev
|
libevdev
|
||||||
libinput
|
libinput
|
||||||
pixman
|
pixman
|
||||||
udev
|
udev
|
||||||
wayland
|
wayland
|
||||||
wayland-protocols
|
wayland-protocols
|
||||||
wlroots_0_19
|
wlroots_0_19
|
||||||
libx11
|
libx11
|
||||||
libxkbcommon
|
libxkbcommon
|
||||||
];
|
];
|
||||||
|
|
||||||
dontConfigure = true;
|
dontConfigure = true;
|
||||||
});
|
});
|
||||||
repl = pkgs.writeScriptBin "censtablo-repl" ''
|
default = pkgs.stdenv.mkDerivation {
|
||||||
#!/usr/bin/env janet
|
pname = "censtablo";
|
||||||
(import spork/netrepl)
|
version = "0.1.0";
|
||||||
|
src = ./.;
|
||||||
(netrepl/client :unix (string (os/getenv "XDG_RUNTIME_DIR") "/censtablo-" (os/getenv "WAYLAND_DISPLAY")))
|
nativeBuildInputs = [pkgs.pkg-config janet-pm];
|
||||||
'';
|
|
||||||
in [pkgs.janet janet-pm river-pkg repl];
|
|
||||||
|
|
||||||
nativeBuildInputs = [pkgs.pkg-config];
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
(pkgs.wayland.overrideAttrs (final: prev: {
|
(pkgs.wayland.overrideAttrs (final: prev: {
|
||||||
patches =
|
patches =
|
||||||
@@ -109,17 +94,84 @@
|
|||||||
pkgs.wayland-scanner
|
pkgs.wayland-scanner
|
||||||
pkgs.wayland-protocols
|
pkgs.wayland-protocols
|
||||||
libxkbcommon
|
libxkbcommon
|
||||||
|
pkgs.janet
|
||||||
];
|
];
|
||||||
|
|
||||||
RIVER_PROTOCOLS = "${river}/protocol/";
|
RIVER_PROTOCOLS = "${inputs.river}/protocol/";
|
||||||
|
deps = [
|
||||||
|
"${pkgs.fetchFromGitHub {
|
||||||
|
owner = "janet-lang";
|
||||||
|
repo = "pkgs";
|
||||||
|
rev = "master";
|
||||||
|
hash = "sha256-VPzMcRq8oerlHwDegKaqP6MpOMsUprDAAzyqrI7YEY8=";
|
||||||
|
}}:git__https___github.com_janet-lang_pkgs.git"
|
||||||
|
"${spork}:git__https___github.com_janet-lang_spork"
|
||||||
|
"${pkgs.fetchFromGitHub {
|
||||||
|
owner = "pyrmont";
|
||||||
|
repo = "lemongrass";
|
||||||
|
rev = "master";
|
||||||
|
hash = "sha256-OUqK57EYh6McnxnbvqoPm92eBMYM5iNaPuN6R0yZHA4=";
|
||||||
|
}}:git__https___github.com_pyrmont_lemongrass"
|
||||||
|
"${pkgs.fetchFromGitea {
|
||||||
|
domain = "codeberg.org";
|
||||||
|
owner = "ifreund";
|
||||||
|
repo = "janet-wayland";
|
||||||
|
rev = "189eb3b2e3a87a676b7f682d8cf1764bb6eb457f";
|
||||||
|
hash = "sha256-dIGjPeBL8/enIwwrSMqNdSOtBWnyo1ioHSLcL1VN2uI=";
|
||||||
|
}}:git__https___codeberg.org_ifreund_janet-wayland"
|
||||||
|
"${pkgs.fetchFromGitea {
|
||||||
|
domain = "codeberg.org";
|
||||||
|
owner = "ifreund";
|
||||||
|
repo = "janet-xkbcommon";
|
||||||
|
rev = "main";
|
||||||
|
hash = "sha256-W7X1ABu1v2+sqZ29OICiYYaFixxXo4uclYfsF4OMAPE=";
|
||||||
|
}}:git__https___codeberg.org_ifreund_janet-xkbcommon"
|
||||||
|
];
|
||||||
|
|
||||||
|
buildPhase = ''
|
||||||
|
export JANET_OFFLINE=1
|
||||||
|
export JANET_PATH=$PWD/janet-path
|
||||||
|
export JANET_BUILD_DIR=$(mktemp -d)
|
||||||
|
mkdir -p $JANET_PATH/.cache
|
||||||
|
cd $JANET_PATH/.cache
|
||||||
|
for dep in $deps; do
|
||||||
|
echo $dep
|
||||||
|
cp -r --no-preserve=mode $(tr ':' ' ' <<<"$dep")
|
||||||
|
f=$(sed -e 's/.*://' <<<"$dep")/bundle/info.jdn
|
||||||
|
[ -f "$f" ] && sed -ie 's/:(jpm-)?dependencies @\[.*\]//' $f
|
||||||
|
done
|
||||||
|
cd -
|
||||||
|
janet-pm install https://github.com/janet-lang/spork
|
||||||
|
janet-pm install https://github.com/pyrmont/lemongrass
|
||||||
|
janet-pm install https://codeberg.org/ifreund/janet-wayland
|
||||||
|
janet-pm install https://codeberg.org/ifreund/janet-xkbcommon
|
||||||
|
janet-pm install
|
||||||
|
'';
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
install -D -t $out/bin/ ./janet-path/bin/censtablo{,-repl}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
inherit default janet-pm river;
|
||||||
|
});
|
||||||
|
devShells = eachSystem ({
|
||||||
|
pkgs,
|
||||||
|
system,
|
||||||
|
ownPkgs,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
default = pkgs.mkShell {
|
||||||
|
inputsFrom = [ownPkgs.default];
|
||||||
|
inherit (ownPkgs.default) RIVER_PROTOCOLS;
|
||||||
|
packages = [ownPkgs.janet-pm];
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
export JANET_PATH="$PWD/.jpm"
|
export JANET_PATH="$PWD/.jpm"
|
||||||
mkdir -p $JANET_PATH
|
mkdir -p $JANET_PATH
|
||||||
# Put this at the end so that installing spork in a local environment _doesn't_ override the janet-pm we're providing with patches so that pkg-config doesn't get `with-path`
|
# Put this at the end so that installing spork in a local environment _doesn't_ override the janet-pm we're providing with patches so that pkg-config doesn't get `with-path`
|
||||||
export PATH="$PATH:$JANET_PATH/bin/"
|
export PATH="$PATH:$JANET_PATH/bin/"
|
||||||
'';
|
'';
|
||||||
});
|
};
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
6
lockfile.jdn
Normal file
6
lockfile.jdn
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
[
|
||||||
|
{:config @{:auto-remove true :installed-with "spork/pm" :pm {:type :git :url "https://github.com/pyrmont/lemongrass"}} :name "lemongrass" :pm {:type :git :url "https://github.com/pyrmont/lemongrass"}}
|
||||||
|
{:config @{:auto-remove true :installed-with "spork/pm" :pm {:type :git :url "https://github.com/janet-lang/spork"}} :name "spork" :pm {:type :git :url "https://github.com/janet-lang/spork"}}
|
||||||
|
{:config @{:auto-remove true :installed-with "spork/pm" :pm {:type :git :url "https://codeberg.org/ifreund/janet-wayland"}} :name "wayland" :pm {:type :git :url "https://codeberg.org/ifreund/janet-wayland"}}
|
||||||
|
{:config @{:auto-remove true :installed-with "spork/pm" :pm {:type :git :url "https://codeberg.org/ifreund/janet-xkbcommon"}} :name "xkbcommon" :pm {:type :git :url "https://codeberg.org/ifreund/janet-xkbcommon"}}
|
||||||
|
]
|
||||||
13
main.janet
13
main.janet
@@ -496,9 +496,10 @@
|
|||||||
(def ks [:tag-main :tag-offload :tags-other])
|
(def ks [:tag-main :tag-offload :tags-other])
|
||||||
(fn [seat binding]
|
(fn [seat binding]
|
||||||
(def outputs (wm :outputs))
|
(def outputs (wm :outputs))
|
||||||
(def tags (map |(table (seq [k :in ks] k ($ k))) outputs))
|
(def tags (map |(tabseq [k :in ks] k ($ k)) outputs))
|
||||||
(map (fn [out tags]
|
(map (fn [out tags]
|
||||||
(eachp [k tag] tags (put out k tag))) outputs [;(slice tags 1) (first tags)])))
|
(eachp [k tag] tags (put out k tag))) outputs [;(slice tags 1) (first tags)])
|
||||||
|
((action/focus-output :next) seat nil)))
|
||||||
|
|
||||||
(defn rule/pulldown []
|
(defn rule/pulldown []
|
||||||
(fn [window]
|
(fn [window]
|
||||||
@@ -522,11 +523,11 @@
|
|||||||
|
|
||||||
|
|
||||||
(defn locked-screen []
|
(defn locked-screen []
|
||||||
(print "Locked!")
|
|
||||||
(def notifs-status (= 0 (os/execute ["dunstctl" "is-paused" "-e"] :p)))
|
(def notifs-status (= 0 (os/execute ["dunstctl" "is-paused" "-e"] :p)))
|
||||||
(os/execute ["dunstctl" "set-paused" "true"] :p)
|
(os/execute ["dunstctl" "set-paused" "true"] :p)
|
||||||
(os/execute ["pidwait" "swaylock"] :p) # Blocking is fine here -- we're locked
|
(ev/spawn
|
||||||
(os/execute ["dunstctl" "set-paused" (if notifs-status "true" "false")] :p))
|
(os/execute ["pidwait" "swaylock"] :p)
|
||||||
|
(os/execute ["dunstctl" "set-paused" (if notifs-status "true" "false")] :p)))
|
||||||
|
|
||||||
(defn lock-screen []
|
(defn lock-screen []
|
||||||
(spawn "swaylock")
|
(spawn "swaylock")
|
||||||
@@ -583,7 +584,7 @@
|
|||||||
|
|
||||||
|
|
||||||
(defn startup []
|
(defn startup []
|
||||||
(spawn "pkill waybar && waybar")
|
(spawn "pkill waybar; waybar")
|
||||||
(spawn "kanshi")
|
(spawn "kanshi")
|
||||||
|
|
||||||
(spawn "vesktop")
|
(spawn "vesktop")
|
||||||
|
|||||||
@@ -1,9 +1,16 @@
|
|||||||
(declare-project
|
(declare-project
|
||||||
:name "censtablo"
|
:name "censtablo"
|
||||||
:description ""
|
:description ""
|
||||||
:dependencies @["spork" "https://codeberg.org/ifreund/janet-wayland"]
|
|
||||||
:version "0.0.0")
|
:version "0.0.0")
|
||||||
|
|
||||||
(declare-executable
|
(declare-executable
|
||||||
:name "censtablo"
|
:name "censtablo"
|
||||||
:entry "./main.janet")
|
:entry "./main.janet"
|
||||||
|
:install true
|
||||||
|
:pkg-config-libs ["wayland-client" "xkbcommon"])
|
||||||
|
|
||||||
|
(declare-executable
|
||||||
|
:name "censtablo-repl"
|
||||||
|
:entry "./repl.janet"
|
||||||
|
:install true
|
||||||
|
:pkg-config-libs ["wayland-client" "xkbcommon"])
|
||||||
|
|||||||
4
repl.janet
Normal file
4
repl.janet
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
(import spork/netrepl)
|
||||||
|
|
||||||
|
(defn main [exe]
|
||||||
|
(netrepl/client :unix (string (os/getenv "XDG_RUNTIME_DIR") "/censtablo-" (os/getenv "WAYLAND_DISPLAY"))))
|
||||||
Reference in New Issue
Block a user